Class ResponseTransform
- Namespace
- Yarp.ReverseProxy.Transforms
- Assembly
- Yarp.ReverseProxy.dll
Transforms for responses.
public abstract class ResponseTransform
- Inheritance
-
ResponseTransform
- Derived
- Inherited Members
Constructors
ResponseTransform()
protected ResponseTransform()
Methods
ApplyAsync(ResponseTransformContext)
Transforms the given response. The status and headers will have (optionally) already been copied to the HttpResponse and any changes should be made there.
public abstract ValueTask ApplyAsync(ResponseTransformContext context)
Parameters
contextResponseTransformContext
Returns
SetHeader(ResponseTransformContext, string, StringValues)
Sets the given header on the HttpResponse.
public static void SetHeader(ResponseTransformContext context, string headerName, StringValues values)
Parameters
contextResponseTransformContextheaderNamestringvaluesStringValues
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.
public static StringValues TakeHeader(ResponseTransformContext context, string headerName)
Parameters
contextResponseTransformContextThe transform context.
headerNamestringThe name of the header to take.
Returns
- StringValues
The response header value, or StringValues.Empty if none.