HttpMessageInvoker.Send(HttpRequestMessage, CancellationToken) Method

Definition

Sends an HTTP request with the specified request and cancellation token.

public:
 virtual System::Net::Http::HttpResponseMessage ^ Send(System::Net::Http::HttpRequestMessage ^ request, System::Threading::CancellationToken cancellationToken);
public virtual System.Net.Http.HttpResponseMessage Send (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
abstract member Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
override this.Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
Public Overridable Function Send (request As HttpRequestMessage, cancellationToken As CancellationToken) As HttpResponseMessage

Parameters

request
HttpRequestMessage

The HTTP request message to send.

cancellationToken
CancellationToken

The cancellation token to cancel operation.

Returns

HttpResponseMessage

The HTTP response message.

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.

Applies to