Automatically decompress message body if necessary.
Request base path.
HTTP headers.
Check if underlying socket was encrypted with TLS.
Request is a WebSocket handshake.
Request method.
Request path.
Peer address.
Request ID.
Reverse proxy support is activated.
Request URL.
Server base URL.
Remote IP address. Uses he X-Forwarded-For
header value if reverse proxy support is activated.
Request protocol. Uses the X-Forwarded-Proto
header value if reverse proxy support is activated.
User info.
Optional
options: UploadOptionsGet async iterator for uploaded files from message body.
Optional
options: UploadOptions// Iterate over uploaded files
for await (const {fieldname, file, filename} of body.files()) {
const parts = [];
for await (const chunk of file) {
parts.push(chunk);
}
const content = Buffer.concat(parts).toString();
console.write(`${fieldname}: ${content}`);
}
Get form parameters from message body.
Optional
options: UploadOptions// Get a specific parameter
const params = await body.form();
const foo = params.get('foo');
Get JSON message body as parsed data structure.
Set HTTP header for message. // Set Server header body.set('Server', 'mojo.js');
Generated using TypeDoc
Server request class.