Interface IHttpRequest<TRequestContent>
The interface for an HTTP request that is agnostic of the underlying HTTP API.
public interface IHttpRequest<TRequestContent> : IDisposable
Type Parameters
TRequestContent
The type used by the underlying HTTP API to represent the HTTP request content.
- Inherited Members
Properties
Method
The HTTP method or verb.
string Method { get; set; }
Property Value
RequestUri
The request URI.
Uri RequestUri { get; }
Property Value
- Uri
Methods
Abort()
Aborts the HTTP request.
void Abort()
ConfigureRequest(IRequestContext)
Configures a request as per the request context.
void ConfigureRequest(IRequestContext requestContext)
Parameters
requestContext
IRequestContextThe request context.
GetRequestContent()
Gets a handle to the request content.
TRequestContent GetRequestContent()
Returns
- TRequestContent
The request content.
GetRequestContentAsync()
Gets a handle to the request content.
Task<TRequestContent> GetRequestContentAsync()
Returns
- Task<TRequestContent>
GetResponse()
Returns the HTTP response.
IWebResponseData GetResponse()
Returns
- IWebResponseData
The HTTP response.
GetResponseAsync(CancellationToken)
Returns the HTTP response.
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.
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
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 trigerring the progress changes
callback
EventHandler<StreamTransferProgressArgs>The callback which will be invoked when the progress changed event is trigerred
Returns
- Stream
an EventStream object, incase the progress is setup, else returns the original stream
WriteToRequestBody(TRequestContent, byte[], IDictionary<string, string>)
Writes a byte array to the request body.
void WriteToRequestBody(TRequestContent requestContent, byte[] content, IDictionary<string, string> contentHeaders)
Parameters
requestContent
TRequestContentThe destination where the content stream is written.
content
byte[]The content stream to be written.
contentHeaders
IDictionary<string, string>HTTP content headers.
WriteToRequestBody(TRequestContent, Stream, IDictionary<string, string>, IRequestContext)
Writes a stream to the request body.
void WriteToRequestBody(TRequestContent requestContent, Stream contentStream, IDictionary<string, string> contentHeaders, IRequestContext requestContext)
Parameters
requestContent
TRequestContentThe 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.