Table of Contents

Class AWSHttpClient

Namespace
Amazon.Util
Assembly
AWSSDK.Core.dll

AwsHttpClient is a wrapper around HttpClient class of the System.Net.Http library. The wrapper has been added so as to remove System.Net.Http dependencies from the Services and migrate it to a Core level dependecy only. This avoids version clashes when a service and the Core depends on different versions of the System.Net.Http library. This is a Service level utility method

public class AWSHttpClient : IDisposable
Inheritance
AWSHttpClient
Implements
Inherited Members

Constructors

AWSHttpClient()

AWSHttpClient wrapper that is wrapped around HttpClient default wrapper.

public AWSHttpClient()

Properties

BaseAddress

AWSHttpClient BaseAddress property that is wrapper for HttpClient BaseAddress property.

public Uri BaseAddress { get; set; }

Property Value

Uri

MaxResponseContentBufferSize

AWSHttpClient MaxResponseContentBufferSize property that is wrapper for HttpClient MaxResponseContentBufferSize property.

public long MaxResponseContentBufferSize { get; set; }

Property Value

long

Timeout

AWSHttpClient Timeout property that is wrapper for HttpClient Timeout property.

public TimeSpan Timeout { get; set; }

Property Value

TimeSpan

Methods

Dispose()

Wrapper for HttpClient Dispose.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

GetResponseHeadersAsync(string, string)

Wrapper for HttpClient's HttpRequestMessage and SendAsync methods.

public Task<List<Tuple<string, IEnumerable<string>, HttpStatusCode>>> GetResponseHeadersAsync(string httpMethodValue, string url)

Parameters

httpMethodValue string
url string

Returns

Task<List<Tuple<string, IEnumerable<string>, HttpStatusCode>>>

Returns response headers information- header name,value and status code

GetStreamAsync(string)

AWSHttpClient GetStreamAsync that accepts the requester's URI and make a HttpClient.GetStreamAsync call.

public Task<Stream> GetStreamAsync(string requestUri)

Parameters

requestUri string

Requester Uri

Returns

Task<Stream>

IsHttpInnerException(Exception)

Method that checks if the passed exception is of type HttpRequestException

public static bool IsHttpInnerException(Exception exception)

Parameters

exception Exception

Returns

bool

PutRequestUriAsync(string, AWSStreamContent, IDictionary<string, string>)

Wrapper method that accepts a request uri, stream content and headers and makes a sendAsync call.

public Task PutRequestUriAsync(string requestUri, AWSStreamContent content, IDictionary<string, string> requestHeaders)

Parameters

requestUri string
content AWSStreamContent
requestHeaders IDictionary<string, string>

Returns

Task