HttpAsync Method
Definition
- Namespace
- Cuemon.Extensions.Net.Http
- Assemblies
- Cuemon.Extensions.Net.dll
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
locationUriThe Uri to extend.
methodHttpMethodThe HTTP method.
contentTypestringThe Content-Type header of the HTTP request sent to the server.
contentStreamThe HTTP request content sent to the server.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null -or-methodcannot be null -or-contentTypecannot be null -or-contentcannot 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
locationUriThe Uri to extend.
methodHttpMethodThe HTTP method.
contentTypeMediaTypeHeaderValueThe Content-Type header of the HTTP request sent to the server.
contentStreamThe HTTP request content sent to the server.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null -or-methodcannot be null -or-contentTypecannot be null -or-contentcannot 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
locationUriThe Uri to extend.
setupAction<HttpRequestOptions>The HttpRequestOptions which need to be configured.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.