Table of Contents

HttpAsync Method

Definition

Namespace
Cuemon.Net.Http
Assemblies
Cuemon.Net.dll
Source
src/Cuemon.Net/Http/HttpManager.cs

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

Send a request as an asynchronous operation.

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

Parameters

method HttpMethod

The HTTP method.

location Uri

The Uri to request.

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

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

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

Send a request as an asynchronous operation.

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

Parameters

method HttpMethod

The HTTP method.

location Uri

The Uri to request.

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

method cannot be null -or- location 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 virtual Task<HttpResponseMessage> HttpAsync(Uri location, Action<HttpRequestOptions> setup)

Parameters

location Uri

The Uri to request.

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 -or- setup cannot be null.