Table of Contents

Class HttpClientExtensions

Namespace
Songhay.Extensions
Assembly
SonghayCore.dll

Extensions of HttpClient

public static class HttpClientExtensions
Inheritance
HttpClientExtensions
Inherited Members

Methods

DeleteAsync(HttpClient?, Uri?, Action<HttpRequestMessage>?)

public static Task<HttpResponseMessage?> DeleteAsync(this HttpClient? client, Uri? uri, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

DownloadToFileAsync(HttpClient?, Uri?, string)

Downloads resource at URI to the specified path.

public static Task DownloadToFileAsync(this HttpClient? client, Uri? uri, string path)

Parameters

client HttpClient

The request.

uri Uri

The URI.

path string

The path.

Returns

Task

DownloadToFileAsync(HttpClient?, Uri?, string, Action<HttpRequestMessage>?)

Downloads resource at URI to the specified path.

public static Task DownloadToFileAsync(this HttpClient? client, Uri? uri, string path, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The request.

uri Uri

The URI.

path string

The path.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task

DownloadToStringAsync(HttpClient?, Uri?)

Downloads resource at URI to string.

public static Task<string?> DownloadToStringAsync(this HttpClient? client, Uri? uri)

Parameters

client HttpClient

The request.

uri Uri

The URI.

Returns

Task<string>

DownloadToStringAsync(HttpClient?, Uri?, Action<HttpRequestMessage>?)

Downloads resource at URI to string.

public static Task<string?> DownloadToStringAsync(this HttpClient? client, Uri? uri, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The request.

uri Uri

The URI.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<string>

GetAsync(HttpClient?, Uri?, Action<HttpRequestMessage>?)

public static Task<HttpResponseMessage?> GetAsync(this HttpClient? client, Uri? uri, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

PostFormAsync(HttpClient?, Uri?, Hashtable)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationFormUrlEncoded request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostFormAsync(this HttpClient? client, Uri? uri, Hashtable formData)

Parameters

client HttpClient

The client.

uri Uri

The URI.

formData Hashtable

The form data.

Returns

Task<HttpResponseMessage>

PostFormAsync(HttpClient?, Uri?, Hashtable, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationFormUrlEncoded request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostFormAsync(this HttpClient? client, Uri? uri, Hashtable formData, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

formData Hashtable

The form data.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

PostJsonAsync(HttpClient?, Uri?, string)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationJson request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostJsonAsync(this HttpClient? client, Uri? uri, string requestBody)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

Returns

Task<HttpResponseMessage>

PostJsonAsync(HttpClient?, Uri?, string, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationJson request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostJsonAsync(this HttpClient? client, Uri? uri, string requestBody, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

PostXmlAsync(HttpClient?, Uri?, string)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationXml request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostXmlAsync(this HttpClient? client, Uri? uri, string requestBody)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

Returns

Task<HttpResponseMessage>

PostXmlAsync(HttpClient?, Uri?, string, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationXml request body using Post and UTF8.

public static Task<HttpResponseMessage?> PostXmlAsync(this HttpClient? client, Uri? uri, string requestBody, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

PutJsonAsync(HttpClient?, Uri?, string)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationJson request body using Put and UTF8.

public static Task<HttpResponseMessage?> PutJsonAsync(this HttpClient? client, Uri? uri, string requestBody)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

Returns

Task<HttpResponseMessage>

PutJsonAsync(HttpClient?, Uri?, string, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationJson request body using Put and UTF8.

public static Task<HttpResponseMessage?> PutJsonAsync(this HttpClient? client, Uri? uri, string requestBody, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

PutXmlAsync(HttpClient?, Uri?, string)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationXml request body using Put and UTF8.

public static Task<HttpResponseMessage?> PutXmlAsync(this HttpClient? client, Uri? uri, string requestBody)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

Returns

Task<HttpResponseMessage>

PutXmlAsync(HttpClient?, Uri?, string, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified ApplicationXml request body using Put and UTF8.

public static Task<HttpResponseMessage?> PutXmlAsync(this HttpClient? client, Uri? uri, string requestBody, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

requestBody string

The request body.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

SendAsync(HttpClient?, Uri?, HttpMethod, Action<HttpRequestMessage>?)

public static Task<HttpResponseMessage?> SendAsync(this HttpClient? client, Uri? uri, HttpMethod method, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

method HttpMethod

The method.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>

SendBodyAsync(HttpClient?, Uri?, HttpMethod, string?, Encoding, string?, Action<HttpRequestMessage>?)

Calls SendAsync(HttpRequestMessage) with the specified request body.

public static Task<HttpResponseMessage?> SendBodyAsync(this HttpClient? client, Uri? uri, HttpMethod method, string? requestBody, Encoding encoding, string? mediaType, Action<HttpRequestMessage>? requestMessageAction)

Parameters

client HttpClient

The client.

uri Uri

The URI.

method HttpMethod

The method.

requestBody string

The request body.

encoding Encoding

The encoding.

mediaType string

Type of the media.

requestMessageAction Action<HttpRequestMessage>

The request message action.

Returns

Task<HttpResponseMessage>