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.";


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


addHeader (key, value) Add a http header. You can't set content-length, date, 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) Serve a file from disk. If you want to delete the file after serving it, use serveFile!(OnFileServed.deleteFile).
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.