Class HttpManagerExtensions
This is an extension implementation of the most common methods on the HttpManager class.
Inheritance
Namespace: Cuemon.Net.Http
Assembly: Cuemon.Net.dll
Syntax
public static class HttpManagerExtensions
Methods
| Improve this DocHttpAsync(Uri, Action<HttpRequestOptions>)
Send a request as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpAsync(this Uri location, Action<HttpRequestOptions> setup)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Action<HttpRequestOptions> | setup | The HttpRequestOptions which need to be configured. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpAsync(Uri, HttpMethod, MediaTypeHeaderValue, Stream, CancellationToken)
Send a request as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Net.Http.HttpMethod | method | The HTTP method. |
System.Net.Http.Headers.MediaTypeHeaderValue | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpAsync(Uri, HttpMethod, String, Stream, CancellationToken)
Send a request as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Net.Http.HttpMethod | method | The HTTP method. |
System.String | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpDeleteAsync(Uri, CancellationToken)
Send a DELETE request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpDeleteAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpGetAsync(Uri, CancellationToken)
Send a GET request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpGetAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpHeadAsync(Uri, CancellationToken)
Send a HEAD request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpHeadAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpOptionsAsync(Uri, CancellationToken)
Send an OPTIONS request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpOptionsAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPatchAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPatchAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Net.Http.Headers.MediaTypeHeaderValue | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPatchAsync(Uri, String, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPatchAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.String | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPostAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPostAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Net.Http.Headers.MediaTypeHeaderValue | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPostAsync(Uri, String, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPostAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.String | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPutAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPutAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Net.Http.Headers.MediaTypeHeaderValue | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpPutAsync(Uri, String, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpPutAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.String | contentType | The Content-Type header of the HTTP request sent to the server. |
System.IO.Stream | content | The HTTP request content sent to the server. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |
HttpTraceAsync(Uri, CancellationToken)
Send a TRACE request to the specified Uri as an asynchronous operation.
Declaration
public static Task<HttpResponseMessage> HttpTraceAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.Uri | location | The System.Uri to request. |
System.Threading.CancellationToken | ct | The cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | The task object representing the asynchronous operation. |