Class ResponseTransform
Transforms for responses.
Inheritance
System.Object
ResponseTransform
Namespace: Yarp.ReverseProxy.Transforms
Assembly: Yarp.ReverseProxy.dll
Syntax
public abstract class ResponseTransform : object
Methods
| Improve this Doc View SourceApplyAsync(ResponseTransformContext)
Transforms the given response. The status and headers will have (optionally) already been
copied to the
Declaration
public abstract ValueTask ApplyAsync(ResponseTransformContext context)
Parameters
Type | Name | Description |
---|---|---|
ResponseTransformContext | context |
Returns
Type | Description |
---|---|
ValueTask |
SetHeader(ResponseTransformContext, String, StringValues)
Sets the given header on the HttpResponse.
Declaration
public static void SetHeader(ResponseTransformContext context, string headerName, StringValues values)
Parameters
Type | Name | Description |
---|---|---|
ResponseTransformContext | context | |
System.String | headerName | |
StringValues | values |
TakeHeader(ResponseTransformContext, String)
Removes and returns the current header value by first checking the HttpResponse and falling back to the value from HttpResponseMessage or HttpContent only if HeadersCopied is not set. This ordering allows multiple transforms to mutate the same header.
Declaration
public static StringValues TakeHeader(ResponseTransformContext context, string headerName)
Parameters
Type | Name | Description |
---|---|---|
ResponseTransformContext | context | The transform context. |
System.String | headerName | The name of the header to take. |
Returns
Type | Description |
---|---|
StringValues | The response header value, or StringValues.Empty if none. |