Example
req.response(200, "OK")
.cookie("MyCookie", "42")
.body("Hello World", "text/html")
.send();
Methods
-
body (s, mimetype)server.HTTPResponse
-
Sets the response body.
Name Type Description s
string The response body.
mimetype
string The MIME type of the response body.
Returns:
Type Description server.HTTPResponse The response object for chaining multiple methods. -
cookie (name, value)server.HTTPResponse
-
Sets a HTTP cookie.
Name Type Description name
string The cookie name.
value
string The cookie value.
Returns:
Type Description server.HTTPResponse The response object for chaining multiple methods. -
enableCrossOriginIsolation ()server.HTTPResponse
-
Enables Cross-Origin-Isolation by setting the appropriate HTTP headers.
Returns:
Type Description server.HTTPResponse The response object for chaining multiple methods. -
header (name, value)server.HTTPResponse
-
Sets a HTTP header.
Name Type Description name
string The header name.
value
string The header value.
Returns:
Type Description server.HTTPResponse The response object for chaining multiple methods. -
Sends the response.
-
stream (s, mimetype, dataSize)server.HTTPResponse
-
Pipes a stream for chunked transfer.
Name Type Description s
ReadableStream The stream.
mimetype
string The MIME type of the data.
dataSize
number The expected size of data in bytes, or -1 for unknown size.
Returns:
Type Description server.HTTPResponse The response object for chaining multiple methods.