Request

Container for a HTTP request.

Constructors

this
this()
Undocumented in source.
this
this(string method, string path, string[string] headers)
Undocumented in source.

Members

Functions

parse
bool parse(string data)

Parses a string and returns a Request. If the request is successfully parsed Request.valid will be true. Please note that every key in the header is converted to lowercase for an easier search in the associative array.

toString
string toString()

Encodes the request into a string.

Static functions

get
Request get(string path, string[string] headers)

Creates a get request.

post
Request post(string path, string[string] headers, string body_)
Request post(string path, string data, string[string] headers)

Creates a post request.

Variables

path
string path;

Path of the request. It should start with a slash.

Inherited Members

From HTTP

VERSION
enum VERSION;
Undocumented in source.
GET
enum GET;
Undocumented in source.
POST
enum POST;
Undocumented in source.
method
string method;

Method used.

headers
string[string] headers;

Headers of the request/response.

_body
string _body;
Undocumented in source.
body_
string body_ [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
body_
void[] body_ [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

new Request("GET", "/");
new Request(Request.POST, "/subscribe.php");

Meta