Class UriExtensions
- Namespace
- Cuemon.Extensions.Net.Http
- Assembly
- Cuemon.Extensions.Net.dll
Extension methods for the Uri struct.
public static class UriExtensions
- Inheritance
-
UriExtensions
Properties
DefaultHttpClientFactory
Gets or sets the default IHttpClientFactory implementation for the extensions methods on this class.
public static IHttpClientFactory DefaultHttpClientFactory { get; set; }
Property Value
- IHttpClientFactory
The default IHttpClientFactory implementation for the URI extensions methods on this class.
Methods
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.
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, 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.
HttpDeleteAsync(Uri, CancellationToken)
Send a DELETE request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpDeleteAsync(this Uri location, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.
HttpGetAsync(Uri, CancellationToken)
Send a GET request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpGetAsync(this Uri location, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.
HttpHeadAsync(Uri, CancellationToken)
Send a HEAD request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpHeadAsync(this Uri location, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.
HttpOptionsAsync(Uri, CancellationToken)
Send an OPTIONS request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpOptionsAsync(this Uri location, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.
HttpPatchAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPatchAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpPatchAsync(Uri, string, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPatchAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpPostAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPostAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpPostAsync(Uri, string, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPostAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpPutAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPutAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpPutAsync(Uri, string, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpPutAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
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.
HttpTraceAsync(Uri, CancellationToken)
Send a TRACE request to the specified Uri as an asynchronous operation.
public static Task<HttpResponseMessage> HttpTraceAsync(this Uri location, CancellationToken ct = default)
Parameters
locationUriThe Uri to extend.
ctCancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
locationcannot be null.