Table of Contents

Class HttpClientExtensions

Namespace
TypedRest.Http
Assembly
TypedRest.dll

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 HttpClient

The HTTP client to configure.

credentials NetworkCredential

The 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 HttpClient
uri Uri
cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

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 HttpClient
uri Uri
cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

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 HttpClient
uri Uri
value T
formatter MediaTypeFormatter
cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Type Parameters

T