Class
HttpRequest

Used to create and manipulate an HTTP request.

Definition

Namespace:ArtOfTest.WebAii.Messaging.Http

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
public class HttpRequest

Inheritance: objectHttpRequest

Constructors

HttpRequest()

Creates an empty HttpRequest object

Declaration

cs-api-definition
public HttpRequest()

HttpRequest(byte[])

Create a new HttpRequest object from the given network data

Declaration

cs-api-definition
public HttpRequest(byte[] buffer)

Parameters

buffer

byte[]

A buffer containing the network data that will be parsed to generate an HttpRequest object

Properties

Content

Gets / Sets the content of this request

Declaration

cs-api-definition
public byte[] Content { get; set; }

Property Value

byte[]

DecodedBody

Returns a string representing the body; HTTP chunking and (known) compression types are removed, and the text encoding specified by the content is used.

Declaration

cs-api-definition
public string DecodedBody { get; }

Property Value

string

Guid

Gets the unique identifier of this request

Declaration

cs-api-definition
public Guid Guid { get; set; }

Property Value

Guid

HasCloseConnectionOption

Gets whether this request specifies that the connection be closed after a response to it is received

Declaration

cs-api-definition
public bool HasCloseConnectionOption { get; }

Property Value

bool

Headers

Gets / Sets the headers for this request

Declaration

cs-api-definition
public NameValueCollection Headers { get; set; }

Property Value

NameValueCollection

HttpMethod

Gets / Sets the HTTP method of this request

Declaration

cs-api-definition
public string HttpMethod { get; set; }

Property Value

string

HttpVersion

Gets / Sets the HTTP version string of this request

Declaration

cs-api-definition
public string HttpVersion { get; set; }

Property Value

string

ID

Gets the ID number of this request

Declaration

cs-api-definition
public int ID { get; }

Property Value

int

RequestUri

Gets / Sets the URI of this request.

Declaration

cs-api-definition
public string RequestUri { get; set; }

Property Value

string

Remarks

The URI should not contain the server to which the request is directed. It should only contain the path on the server of the requested resource. The server's IP address or DNS name should be stored in the 'Host' header. For example, to request the page 'http://www.example.com/directory/file.html', the URI string should be "/directory/file.html" and the Host header should be "www.example.com".

Response

Gets / Sets the response to this request. If a response is set, the request will not be sent to the server.

Declaration

cs-api-definition
public HttpResponse Response { get; set; }

Property Value

HttpResponse

Timestamp

The time at which this request was sent to the server

Declaration

cs-api-definition
public DateTime Timestamp { get; set; }

Property Value

DateTime

Methods

CleanUpConnectionOptions()

Strips out any headers matching the tokens listed in the Connection header, and removes all tokens from the Connection header except for 'close'.

Declaration

cs-api-definition
public void CleanUpConnectionOptions()

GetPostFormContent()

Declaration

cs-api-definition
public NameValueCollection GetPostFormContent()

Returns

NameValueCollection

GetUnchunkedContent()

Declaration

cs-api-definition
public byte[] GetUnchunkedContent()

Returns

byte[]

ToByteArray()

Rebuilds the HTTP query

Declaration

cs-api-definition
public byte[] ToByteArray()

Returns

byte[]

A byte array representing the rebuilt HTTP query string.

ToString()

Converts this HTTP request object to a string representation. HTTP request header information will not be included.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string representation of this header request.

Overrides object.ToString()

ToString(bool)

Converts this HTTP request object to a string representation.

Declaration

cs-api-definition
public string ToString(bool PrintHeaders)

Parameters

PrintHeaders

bool

Set to true to have the HTTP request header information to be included.

Returns

string

A string representation of this header request.