Class AWSHttpClient
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
Timeout
AWSHttpClient Timeout property that is wrapper for HttpClient Timeout property.
public TimeSpan Timeout { get; set; }
Property Value
Methods
Dispose()
Wrapper for HttpClient Dispose.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
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
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
requestUristringRequester Uri
Returns
IsHttpInnerException(Exception)
Method that checks if the passed exception is of type HttpRequestException
public static bool IsHttpInnerException(Exception exception)
Parameters
exceptionException
Returns
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
requestUristringcontentAWSStreamContentrequestHeadersIDictionary<string, string>