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()
BeginGetRequestContent(AsyncCallback, object)
Initiates the operation to gets a handle to the request content.
IAsyncResult BeginGetRequestContent(AsyncCallback callback, object state)
Parameters
callback
AsyncCallbackThe async callback invoked when the operation completes.
state
objectThe state object to be passed to the async callback.
Returns
- IAsyncResult
IAsyncResult that represents an async operation.
BeginGetResponse(AsyncCallback, object)
Initiates the operation to Returns the HTTP response.
IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
Parameters
callback
AsyncCallbackThe async callback invoked when the operation completes.
state
objectThe state object to be passed to the async callback.
Returns
- IAsyncResult
IAsyncResult that represents an async operation.
ConfigureRequest(IRequestContext)
Configures a request as per the request context.
void ConfigureRequest(IRequestContext requestContext)
Parameters
requestContext
IRequestContextThe request context.
EndGetRequestContent(IAsyncResult)
Ends the operation to gets a handle to the request content.
TRequestContent EndGetRequestContent(IAsyncResult asyncResult)
Parameters
asyncResult
IAsyncResultIAsyncResult that represents an async operation.
Returns
- TRequestContent
The request content.
EndGetResponse(IAsyncResult)
Ends the operation to Returns the HTTP response.
IWebResponseData EndGetResponse(IAsyncResult asyncResult)
Parameters
asyncResult
IAsyncResultIAsyncResult that represents an async operation.
Returns
- IWebResponseData
The HTTP response.
GetRequestContent()
Gets a handle to the request content.
TRequestContent GetRequestContent()
Returns
- TRequestContent
The request content.
GetResponse()
Returns the HTTP response.
IWebResponseData GetResponse()
Returns
- IWebResponseData
The HTTP response.
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.