Output

A response to user. Default content-type is "text/html".

// Set status code to 404
output.status = 404

// Send a response. Same as: output.write("Sorry, page not found.");
output ~= "Sorry, page not found.";

Members

Functions

addHeader
void addHeader(string key, string value)
void addHeader(string key, Duration dur)
void addHeader(string key, SysTime time)

Add a http header. You can't set content-length, status or transfer-encoding headers. They are managed by serverino internally.

opAssign
void opAssign(bool v)

Mute/unmute output. If false, serverino will not send any data to user.

opOpAssign
void opOpAssign(T data)

Syntax sugar. Easier way to write output.

sendData
void sendData(string data)
Undocumented in source. Be warned that the author may not have intended to support it.
sendData
void sendData(void[] data)
Undocumented in source. Be warned that the author may not have intended to support it.
serveFile
bool serveFile(string path, bool guessMime)

You can reply with a file. Automagical mime-type detection.

setCookie
void setCookie(Cookie c)

Add or edit a cookie. To delete a cookie, use cookie.invalidate() and then setCookie(cookie)

setTimeout
void setTimeout(Duration max)

Override timeout for this request

write
void write(string data)
void write(void[] data)

Write data to output. You can write as many times as you want.

Properties

status
ushort status [@property getter]

Read status.

status
ushort status [@property setter]

Set response status. 200 by default.

Static functions

toHTTPDate
string toHTTPDate(SysTime t)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

KeyValue
struct KeyValue
Undocumented in source.
OutputImpl
struct OutputImpl
Undocumented in source.

Variables

_internal
OutputImpl* _internal;
Undocumented in source.

Meta