WebData

{WebData} Object to store all HTTP request-reply data and pass between handlers and server Attributes: - route: route name in the server route table (R) - rawuri: full URL string (R) - uri: URL hostname (R) - method: GET, POST, etc (R) - type: content-type (R/W) - length: size of request data (R) - path: array with URL path splitted by slashes (R) - param: srtingstring http param list like ?key=value (R) - headers: srtingstring http headers (R/W) - rawdtata: ubyte[] POST data of binary types (R/W) - json: POST data of json type (R/W) - text: POST data of text-like types (R/W) - status: enum http_status (W)

struct WebData {
string route;
string rawuri;
string uri;
string[] path;
string[string] param;
string[string] headers;
string type;
size_t length;
string method;
ubyte[] rawdata;
string text;
JSONValue json;
http_status status;
string msg;
}

Members

Functions

clear
void clear()

Clear data

export_req
nng_http_req* export_req()

Convert to nng_http_req

export_res
nng_http_res* export_res()

Convert to nng_http_res

parse_req
void parse_req(nng_http_req* req)

Parse nng_http_req and fill the structure

parse_res
void parse_res(nng_http_res* res)

Parse nng_http_res and fill data

toJSON
JSONValue toJSON(string tag)

Jsonify data

toString
string toString()

Stringify data