Struct Request

A request from user. Do not store ref to this struct anywhere.

struct Request ;
void handler(Request request, Output output)
{
   info("You asked for ", request.uri, " with method ", request.method, " and params ", request.get.data);
}

Properties

NameTypeDescription
body[get] std.typecons.Tuple!(const(char)[],"data",string,"contentType")Raw posted data
cookie[get] Request.SafeAccess!(string)Cookies received from user
form[get] Request.SafeAccess!(serverino.interfaces.Request.FormData)The fields from a form. Only if content-type is "multipart/form-data".
get[get] Request.SafeAccess!(string)Params from query string
header[get] Request.SafeAccess!(string)Http headers, always lowercase
host[get] const(string)The host that received the request
method[get] Request.MethodHTTP method
password[get] const(string)Basic http authentication password. Safe only if sent thru https!
post[get] Request.SafeAccess!(string)Params from post if content-type is "application/x-www-form-urlencoded"
requestLine[get] const(string)Use at your own risk! Raw data from user.
route[get] const(string[])The sequence of endpoints called so far
uri[get] const(string)The uri requested by user
user[get] const(string)Basic http authentication user. Safe only if sent thru https!
worker[get] const(string)Which worker is processing this request?

Methods

NameDescription
dump (html) Print request data
toString () Print request data

Inner structs

NameDescription
FormData Data sent through multipart/form-data.
SafeAccess Simple structure to safely access data from an associative array.

Enums

NameDescription
Method HTTP methods