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
httpClientHttpClientThe HttpClient used to make the request.
requestUriUriThe request URI.
configIClientConfigThe 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
requestContextIRequestContextThe request context.
Dispose()
Disposes the HttpWebRequestMessage.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
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
cancellationTokenCancellationTokenA 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
headersIDictionary<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
originalStreamStreamThe content stream
progressUpdateIntervallongThe interval at which progress needs to be published
senderobjectThe objects which is triggering the progress changes
callbackEventHandler<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
requestContentHttpContentThe destination where the content stream is written.
contentbyte[]The content stream to be written.
contentHeadersIDictionary<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
requestContentHttpContentThe destination where the content stream is written.
contentStreamStreamThe content stream to be written.
contentHeadersIDictionary<string, string>HTTP content headers.
requestContextIRequestContextThe request context.