ServerHttpRequest

The HTTP request struct which represents the content of an HTTP request as received by a server.

Members

Functions

getHeaderAs
T getHeaderAs(string headerName, T defaultValue)

Gets a header as the specified type, or returns the default value if the header doesn't exist or cannot be converted to the desired type.

getParamAs
T getParamAs(string paramName, T defaultValue)

Gets a query parameter with a given name, as the specified type, or returns the default value if the parameter doesn't exist.

readBody
StreamResult readBody(S outputStream, bool allowInfiniteRead)

Reads the body of this request and transfers it to the given output stream, limited by the request's "Content-Length" unless you choose to allow infinite reading. If the request includes a header for "Transfer-Encoding: chunked", then it will wrap the input stream in one which decodes HTTP chunked-encoding first.

readBodyAsBytes
ubyte[] readBodyAsBytes(bool allowInfiniteRead)

Reads the request's body into a new byte array.

readBodyAsString
string readBodyAsString(bool allowInfiniteRead)

Reads the request's body into a new string.

Variables

clientAddress
ClientAddress clientAddress;

The remote address of the client that sent this request.

contextData
Object[string] contextData;

Any additional data about this request that may be populated during handling.

headers
const(string[][string]) headers;

A case-insensitive map of all request headers.

httpVersion
HttpVersion httpVersion;

The HTTP version of the request.

inputStream
InputStream!ubyte inputStream;

The underlying stream used to read the body from the request.

method
string method;

The HTTP verb used in the request.

queryParams
QueryParameter[] queryParams;

A list of all URL query parameters.

url
string url;

The URL that was requested, excluding any query parameters.