Request.SafeAccess

Simple structure to safely access data from an associative array.

// request.cookie returns a SafeAccess!string
// get a cookie named "user", default to "anonymous"
auto user = request.cookie.read("user", "anonymous");

// Access the underlying AA
auto data = request.cookie.data;
foreach(k,v; data) info(k, " => ", v);

Members

Functions

has
bool has(string key)

Check if value exists

read
auto read(string key, T defaultValue)

Read a value. Return defaultValue if k does not exist.

toString
auto toString()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

data
auto data [@property getter]

Return the underlying AA

Meta