Class RequestTransform
The base class for request transforms.
Inheritance
System.Object
RequestTransform
Namespace: Yarp.ReverseProxy.Transforms
Assembly: Yarp.ReverseProxy.dll
Syntax
public abstract class RequestTransform : object
Methods
| Improve this Doc View SourceAddHeader(RequestTransformContext, String, StringValues)
Adds the given header to the HttpRequestMessage or HttpContent where applicable.
Declaration
public static void AddHeader(RequestTransformContext context, string headerName, StringValues values)
Parameters
Type | Name | Description |
---|---|---|
RequestTransformContext | context | |
System.String | headerName | |
StringValues | values |
ApplyAsync(RequestTransformContext)
Transforms any of the available fields before building the outgoing request.
Declaration
public abstract ValueTask ApplyAsync(RequestTransformContext context)
Parameters
Type | Name | Description |
---|---|---|
RequestTransformContext | context |
Returns
Type | Description |
---|---|
ValueTask |
RemoveHeader(RequestTransformContext, String)
Removes the given header from the HttpRequestMessage or HttpContent where applicable.
Declaration
public static void RemoveHeader(RequestTransformContext context, string headerName)
Parameters
Type | Name | Description |
---|---|---|
RequestTransformContext | context | |
System.String | headerName |
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.
Declaration
public static StringValues TakeHeader(RequestTransformContext context, string headerName)
Parameters
Type | Name | Description |
---|---|---|
RequestTransformContext | context | The transform context. |
System.String | headerName | The name of the header to take. |
Returns
Type | Description |
---|---|
StringValues | The requested header value, or StringValues.Empty if none. |