Class HttpWebRequestMessage
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
HttpClientThe HttpClient used to make the request.
requestUri
UriThe request URI.
config
IClientConfigThe service client config.
Properties
HttpClient
The underlying HttpClient
public HttpClient HttpClient { get; }
Property Value
Method
The HTTP method or verb.
public string Method { get; set; }
Property Value
Request
The underlying HTTP web request.
public HttpRequestMessage Request { get; }
Property Value
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
IRequestContextThe 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
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
CancellationTokenA cancellation token that can be used to cancel the asynchronous operation.
Returns
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
StreamThe content stream
progressUpdateInterval
longThe interval at which progress needs to be published
sender
objectThe 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
HttpContentThe 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
HttpContentThe destination where the content stream is written.
contentStream
StreamThe content stream to be written.
contentHeaders
IDictionary<string, string>HTTP content headers.
requestContext
IRequestContextThe request context.