Share via


HttpTransformer.TransformRequestAsync Method

Definition

Overloads

TransformRequestAsync(HttpContext, HttpRequestMessage, String)
Obsolete.

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

TransformRequestAsync(HttpContext, HttpRequestMessage, String, CancellationToken)

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

TransformRequestAsync(HttpContext, HttpRequestMessage, String)

Source:
HttpTransformer.cs
Source:
HttpTransformer.cs

Caution

This overload of TransformRequestAsync is obsolete. Override and use the overload accepting a CancellationToken instead.

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

public virtual System.Threading.Tasks.ValueTask TransformRequestAsync(Microsoft.AspNetCore.Http.HttpContext httpContext, System.Net.Http.HttpRequestMessage proxyRequest, string destinationPrefix);
[System.Obsolete("This overload of TransformRequestAsync is obsolete. Override and use the overload accepting a CancellationToken instead.")]
public virtual System.Threading.Tasks.ValueTask TransformRequestAsync(Microsoft.AspNetCore.Http.HttpContext httpContext, System.Net.Http.HttpRequestMessage proxyRequest, string destinationPrefix);
abstract member TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string -> System.Threading.Tasks.ValueTask
override this.TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string -> System.Threading.Tasks.ValueTask
[<System.Obsolete("This overload of TransformRequestAsync is obsolete. Override and use the overload accepting a CancellationToken instead.")>]
abstract member TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string -> System.Threading.Tasks.ValueTask
override this.TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string -> System.Threading.Tasks.ValueTask
Public Overridable Function TransformRequestAsync (httpContext As HttpContext, proxyRequest As HttpRequestMessage, destinationPrefix As String) As ValueTask

Parameters

httpContext
HttpContext

The incoming request.

proxyRequest
HttpRequestMessage

The outgoing proxy request.

destinationPrefix
String

The uri prefix for the selected destination server which can be used to create the RequestUri.

Returns

Attributes

Applies to

TransformRequestAsync(HttpContext, HttpRequestMessage, String, CancellationToken)

Source:
HttpTransformer.cs
Source:
HttpTransformer.cs

A callback that is invoked prior to sending the proxied request. All HttpRequestMessage fields are initialized except RequestUri, which will be initialized after the callback if no value is provided. See MakeDestinationAddress(String, PathString, QueryString) for constructing a custom request Uri. The string parameter represents the destination URI prefix that should be used when constructing the RequestUri. The headers are copied by the base implementation, excluding some protocol headers like HTTP/2 pseudo headers (":authority"). This method may be overridden to conditionally produce a response, such as for error conditions, and prevent the request from being proxied. This is indicated by setting the HttpResponse.StatusCode to a value other than 200, or calling HttpResponse.StartAsync(), or writing to the HttpResponse.Body or BodyWriter.

public virtual System.Threading.Tasks.ValueTask TransformRequestAsync(Microsoft.AspNetCore.Http.HttpContext httpContext, System.Net.Http.HttpRequestMessage proxyRequest, string destinationPrefix, System.Threading.CancellationToken cancellationToken);
abstract member TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
override this.TransformRequestAsync : Microsoft.AspNetCore.Http.HttpContext * System.Net.Http.HttpRequestMessage * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Public Overridable Function TransformRequestAsync (httpContext As HttpContext, proxyRequest As HttpRequestMessage, destinationPrefix As String, cancellationToken As CancellationToken) As ValueTask

Parameters

httpContext
HttpContext

The incoming request.

proxyRequest
HttpRequestMessage

The outgoing proxy request.

destinationPrefix
String

The uri prefix for the selected destination server which can be used to create the RequestUri.

cancellationToken
CancellationToken

Indicates that the request is being canceled.

Returns

Applies to