ClassHttpResponse
Class wrapper of an HTTP response.
Definition
Namespace:ArtOfTest.WebAii.Messaging.Http
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class HttpResponse
Inheritance: objectHttpResponse
Constructors
HttpResponse()
Internal use only. Required for serialization.
Declaration
public HttpResponse()
HttpResponse(HttpResponse)
Copy constructor
Declaration
public HttpResponse(HttpResponse toCopy)
Parameters
toCopy
The HttpResponse object to create a new copy of
HttpResponse(int, HttpRequest)
Create a response object containing an error message
Declaration
public HttpResponse(int errorCode, HttpRequest request)
Parameters
errorCode
The HTTP status code of the error
request
The request that caused the error
Properties
Content
Gets or sets the message body. To remove the body from a message, set Content to null.
Declaration
public byte[] Content { get; set; }
Property Value
byte[]
Remarks
Sets the Content-Length header field to the length of the new message body.
Removes any existing Transfer-Encoding header. If you want to add a message body that is transfer-encoded, you must set the transfer coding for the body after assigning to the message's Content property.
Guid
Gets the unique identifier for this request object
Headers
Gets / Sets the response headers
Declaration
public NameValueCollection Headers { get; set; }
Property Value
HttpVersion
Gets the HTTP version string the server used for this response
IsImage
Gets whether this response contains an image (according to its content-type header)
IsXml
Gets whether this response contains an XML document (according to its content-type header)
MimeType
Gets an array containing all the values specified as MIME types for the content of this response
Request
Gets the request object that caused this response
StatusCode
Gets / Sets the HTTP status code for this response
StatusDescription
Gets / Sets the status description string (e.g. "OK", "Not Found") for this response. Note: Legacy content could include the preceding status code (e.g. "200 OK", "404 Not Found").
Methods
AddHeader(string, string)
Adds a new header to this response's headers. If there is already a header by the same name, the value specified in thie call is added to the list of values for the header.
AppendHeader(string, string)
Adds a new header to this response's headers. If there is already a header by the same name, the value specified in thie call is added to the list of values for the header.
CleanUpConnectionOptions()
Strips out any headers matching the tokens listed in the Connection header, and removes all tokens from the Connection header.
Declaration
public void CleanUpConnectionOptions()
Clear()
Clears all headers and content output from the current response
Declaration
public void Clear()
ClearContent()
Clears the content buffer for the current response
Declaration
public void ClearContent()
ClearHeaders()
Clears all headers from the current response
Declaration
public void ClearHeaders()
ToString()
Gets the string representation of this object.
Declaration
public override string ToString()
Returns
String representation of this object.
Overrides
ToString(bool)
Converts this HttpResponse to a string representation.