Table of Contents

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 RequestTransformContext
headerName string
values StringValues

ApplyAsync(RequestTransformContext)

Transforms any of the available fields before building the outgoing request.

public abstract ValueTask ApplyAsync(RequestTransformContext context)

Parameters

context RequestTransformContext

Returns

ValueTask

RemoveHeader(RequestTransformContext, string)

Removes the given header from the HttpRequestMessage or HttpContent where applicable.

public static void RemoveHeader(RequestTransformContext context, string headerName)

Parameters

context RequestTransformContext
headerName 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 RequestTransformContext

The transform context.

headerName string

The name of the header to take.

Returns

StringValues

The requested header value, or StringValues.Empty if none.