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 async Task<HttpResponseMessage> HttpAsync(this Uri location, Action<HttpRequestOptions> setup)
Parameters
location
UriThe 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.
HttpAsync(Uri, HttpMethod, MediaTypeHeaderValue, Stream, CancellationToken)
Send a request as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
method
HttpMethodThe HTTP method.
contentType
MediaTypeHeaderValueThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe 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, String, Stream, CancellationToken)
Send a request as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpAsync(this Uri location, HttpMethod method, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
method
HttpMethodThe HTTP method.
contentType
StringThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe 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.
HttpDeleteAsync(Uri, CancellationToken)
Send a DELETE request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpDeleteAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpGetAsync(Uri, CancellationToken)
Send a GET request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpGetAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpHeadAsync(Uri, CancellationToken)
Send a HEAD request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpHeadAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpOptionsAsync(Uri, CancellationToken)
Send an OPTIONS request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpOptionsAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPatchAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPatchAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
MediaTypeHeaderValueThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPatchAsync(Uri, String, Stream, CancellationToken)
Send a PATCH request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPatchAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
StringThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPostAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPostAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
MediaTypeHeaderValueThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPostAsync(Uri, String, Stream, CancellationToken)
Send a POST request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPostAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
StringThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPutAsync(Uri, MediaTypeHeaderValue, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPutAsync(this Uri location, MediaTypeHeaderValue contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
MediaTypeHeaderValueThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpPutAsync(Uri, String, Stream, CancellationToken)
Send a PUT request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpPutAsync(this Uri location, string contentType, Stream content, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
contentType
StringThe Content-Type header of the HTTP request sent to the server.
content
StreamThe HTTP request content sent to the server.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.
HttpTraceAsync(Uri, CancellationToken)
Send a TRACE request to the specified Uri as an asynchronous operation.
public static async Task<HttpResponseMessage> HttpTraceAsync(this Uri location, CancellationToken ct = default(CancellationToken))
Parameters
location
UriThe Uri to extend.
ct
CancellationTokenThe cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
location
cannot be null.