Class HttpClientExtensions
Provides extension methods for HttpClient.
public static class HttpClientExtensions
- Inheritance
-
HttpClientExtensions
- Inherited Members
Methods
AddBasicAuth(HttpClient, NetworkCredential)
Adds HTTP Basic authentication.
public static void AddBasicAuth(this HttpClient httpClient, NetworkCredential credentials)
Parameters
httpClient
HttpClientThe HTTP client to configure.
credentials
NetworkCredentialThe credentials to use.
HeadAsync(HttpClient, Uri, CancellationToken)
Send a HEAD request to the specified URI.
public static Task<HttpResponseMessage> HeadAsync(this HttpClient httpClient, Uri uri, CancellationToken cancellationToken = default)
Parameters
httpClient
HttpClienturi
UricancellationToken
CancellationToken
Returns
OptionsAsync(HttpClient, Uri, CancellationToken)
Send an OPTIONS request to the specified URI.
public static Task<HttpResponseMessage> OptionsAsync(this HttpClient httpClient, Uri uri, CancellationToken cancellationToken = default)
Parameters
httpClient
HttpClienturi
UricancellationToken
CancellationToken
Returns
PatchAsync<T>(HttpClient, Uri, T, MediaTypeFormatter, CancellationToken)
public static Task<HttpResponseMessage> PatchAsync<T>(this HttpClient httpClient, Uri uri, T value, MediaTypeFormatter formatter, CancellationToken cancellationToken = default)
Parameters
httpClient
HttpClienturi
Urivalue
Tformatter
MediaTypeFormattercancellationToken
CancellationToken
Returns
Type Parameters
T