Struct 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.";
Properties
Name | Type | Description |
status [get]
|
ushort | Read status.
|
status [set]
|
ushort | Set response status. 200 by default.
|
Methods
Name | Description |
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.
|