Table of Contents

Class HttpWebRequestMessage

Namespace
Amazon.Runtime
Assembly
AWSSDK.Core.dll

HTTP request wrapper for System.Net.Http.HttpRequestMessage.

[CLSCompliant(false)]
public class HttpWebRequestMessage : IHttpRequest<HttpContent>, IDisposable
Inheritance
HttpWebRequestMessage
Implements
Inherited Members

Constructors

HttpWebRequestMessage(HttpClient, Uri, IClientConfig)

The constructor for HttpWebRequestMessage.

public HttpWebRequestMessage(HttpClient httpClient, Uri requestUri, IClientConfig config)

Parameters

httpClient HttpClient

The HttpClient used to make the request.

requestUri Uri

The request URI.

config IClientConfig

The service client config.

Properties

HttpClient

The underlying HttpClient

public HttpClient HttpClient { get; }

Property Value

HttpClient

Method

The HTTP method or verb.

public string Method { get; set; }

Property Value

string

Request

The underlying HTTP web request.

public HttpRequestMessage Request { get; }

Property Value

HttpRequestMessage

RequestUri

The request URI.

public Uri RequestUri { get; }

Property Value

Uri

Methods

Abort()

Aborts the HTTP request.

public void Abort()

ConfigureRequest(IRequestContext)

Configures a request as per the request context.

public void ConfigureRequest(IRequestContext requestContext)

Parameters

requestContext IRequestContext

The request context.

Dispose()

Disposes the HttpWebRequestMessage.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

GetRequestContent()

Gets a handle to the request content.

public HttpContent GetRequestContent()

Returns

HttpContent

The request content.

GetRequestContentAsync()

Gets a handle to the request content.

public Task<HttpContent> GetRequestContentAsync()

Returns

Task<HttpContent>

GetResponse()

Returns the HTTP response.

public IWebResponseData GetResponse()

Returns

IWebResponseData

The HTTP response.

GetResponseAsync(CancellationToken)

Returns the HTTP response.

public Task<IWebResponseData> GetResponseAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used to cancel the asynchronous operation.

Returns

Task<IWebResponseData>

SetRequestHeaders(IDictionary<string, string>)

Sets the headers on the request.

public void SetRequestHeaders(IDictionary<string, string> headers)

Parameters

headers IDictionary<string, string>

A dictionary of header names and values.

SetupProgressListeners(Stream, long, object, EventHandler<StreamTransferProgressArgs>)

Sets up the progress listeners

public Stream SetupProgressListeners(Stream originalStream, long progressUpdateInterval, object sender, EventHandler<StreamTransferProgressArgs> callback)

Parameters

originalStream Stream

The content stream

progressUpdateInterval long

The interval at which progress needs to be published

sender object

The objects which is triggering the progress changes

callback EventHandler<StreamTransferProgressArgs>

The callback which will be invoked when the progress changed event is triggered

Returns

Stream

an EventStream object, incase the progress is setup, else returns the original stream

WriteToRequestBody(HttpContent, byte[], IDictionary<string, string>)

Writes a byte array to the request body.

public void WriteToRequestBody(HttpContent requestContent, byte[] content, IDictionary<string, string> contentHeaders)

Parameters

requestContent HttpContent

The destination where the content stream is written.

content byte[]

The content stream to be written.

contentHeaders IDictionary<string, string>

HTTP content headers.

WriteToRequestBody(HttpContent, Stream, IDictionary<string, string>, IRequestContext)

Writes a stream to the request body.

public void WriteToRequestBody(HttpContent requestContent, Stream contentStream, IDictionary<string, string> contentHeaders, IRequestContext requestContext)

Parameters

requestContent HttpContent

The destination where the content stream is written.

contentStream Stream

The content stream to be written.

contentHeaders IDictionary<string, string>

HTTP content headers.

requestContext IRequestContext

The request context.