Class RequestTransform
- Namespace
- Yarp.ReverseProxy.Transforms
- Assembly
- Yarp.ReverseProxy.dll
The base class for request transforms.
public abstract class RequestTransform
- Inheritance
-
RequestTransform
- Derived
- Inherited Members
Constructors
RequestTransform()
protected RequestTransform()
Methods
AddHeader(RequestTransformContext, string, StringValues)
Adds the given header to the HttpRequestMessage or HttpContent where applicable.
public static void AddHeader(RequestTransformContext context, string headerName, StringValues values)
Parameters
context
RequestTransformContextheaderName
stringvalues
StringValues
ApplyAsync(RequestTransformContext)
Transforms any of the available fields before building the outgoing request.
public abstract ValueTask ApplyAsync(RequestTransformContext context)
Parameters
context
RequestTransformContext
Returns
RemoveHeader(RequestTransformContext, string)
Removes the given header from the HttpRequestMessage or HttpContent where applicable.
public static void RemoveHeader(RequestTransformContext context, string headerName)
Parameters
context
RequestTransformContextheaderName
string
TakeHeader(RequestTransformContext, string)
Removes and returns the current header value by first checking the HttpRequestMessage, then the HttpContent, and falling back to the HttpContext only if HeadersCopied is not set. This ordering allows multiple transforms to mutate the same header.
public static StringValues TakeHeader(RequestTransformContext context, string headerName)
Parameters
context
RequestTransformContextThe transform context.
headerName
stringThe name of the header to take.
Returns
- StringValues
The requested header value, or StringValues.Empty if none.