Request

Container for a HTTP request.

Constructors

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

Members

Functions

toString
string toString()

Encodes the request into a string.

Manifest constants

GET
enum GET;
Undocumented in source.
POST
enum POST;
Undocumented in source.

Static functions

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

Creates a get request.

parse
Request parse(string str)

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.

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

Creates a post request.

Variables

data
string data;

Optional raw form data, for POST requests.

headers
string[string] headers;

HTTP headers of the request.

method
string method;

Method used in the request (i.e. GET). Must be uppercase.

path
string path;

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

valid
bool valid;

If the request was parsed, indicates whether it was in a valid HTTP format.

Examples

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

Meta