Table of Contents

HttpAsync Method

Definition

Namespace
Cuemon.Extensions.Net.Http
Assemblies
Cuemon.Extensions.Net.dll
Source
src/Cuemon.Extensions.Net/Http/UriExtensions.cs

HttpAsync(Uri, HttpMethod, string, Stream, CancellationToken)

Send a request as an asynchronous operation.

public static Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, string contentType, Stream content, CancellationToken ct = default)

Parameters

location Uri

The Uri to extend.

method HttpMethod

The HTTP method.

contentType string

The Content-Type header of the HTTP request sent to the server.

content Stream

The HTTP request content sent to the server.

ct CancellationToken

The cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

location cannot be null -or- method cannot be null -or- contentType cannot be null -or- content cannot be null.

HttpAsync(Uri, HttpMethod, MediaTypeHeaderValue, Stream, CancellationToken)

Send a request as an asynchronous operation.

public static Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default)

Parameters

location Uri

The Uri to extend.

method HttpMethod

The HTTP method.

contentType MediaTypeHeaderValue

The Content-Type header of the HTTP request sent to the server.

content Stream

The HTTP request content sent to the server.

ct CancellationToken

The cancellation token to cancel operation.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

location cannot be null -or- method cannot be null -or- contentType cannot be null -or- content cannot be null.

HttpAsync(Uri, Action<HttpRequestOptions>)

Send a request as an asynchronous operation.

public static Task<HttpResponseMessage> HttpAsync(this Uri location, Action<HttpRequestOptions> setup)

Parameters

location Uri

The Uri to extend.

setup Action<HttpRequestOptions>

The HttpRequestOptions which need to be configured.

Returns

Task<HttpResponseMessage>

The task object representing the asynchronous operation.

Exceptions

ArgumentNullException

location cannot be null.