Struct Output

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

struct Output ;
// Set status code to 404
output.status = 404

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

Properties

NameTypeDescription
status[get] ushortRead status.
status[set] ushortSet response status. 200 by default.

Methods

NameDescription
addHeader (key, value) Add a http header. You can't set content-length, status or transfer-encoding headers. They are managed by serverino internally.
opAssign (v) Mute/unmute output. If false, serverino will not send any data to user.
opOpAssign (data) Syntax sugar. Easier way to write output.
serveFile (path, guessMime) You can reply with a file. Automagical mime-type detection.
setCookie (c) Add or edit a cookie. To delete a cookie, use cookie.invalidate() and then setCookie(cookie)
setTimeout (max) Override timeout for this request
write (data) Write data to output. You can write as many times as you want.