HttpClientHandler.Send(HttpRequestMessage, CancellationToken) Method

Definition

Creates an instance of HttpResponseMessage based on the information provided in the HttpRequestMessage.

protected public:
 override System::Net::Http::HttpResponseMessage ^ Send(System::Net::Http::HttpRequestMessage ^ request, System::Threading::CancellationToken cancellationToken);
protected internal override System.Net.Http.HttpResponseMessage Send (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
protected internal override System.Net.Http.HttpResponseMessage Send (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
override this.Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
override this.Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
Protected Friend Overrides Function Send (request As HttpRequestMessage, cancellationToken As CancellationToken) As HttpResponseMessage

Parameters

request
HttpRequestMessage

The HTTP request message.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The HTTP response message.

Attributes

Exceptions

The request was null.

For HTTP/2 and higher or when requesting version upgrade is enabled by RequestVersionOrHigher.

-or-

If using custom class derived from HttpContent not overriding SerializeToStream(Stream, TransportContext, CancellationToken) method.

-or-

If using custom HttpMessageHandler not overriding Send(HttpRequestMessage, CancellationToken) method.

The request was canceled.

-or-

If the TaskCanceledException exception nests the TimeoutException: The request failed due to timeout.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to