The body of the response.
If json
is explicitly set to true
, it will be serialized into JSON (and content-type
header will be set to application/json
).
It will also be if json
is not explicitly set but the body
value is not a string, not a Buffer
, and not null
either.
After that, the result will eventually be converted to a Buffer
to be sent.
Readonly
headersThe currently set headers. Use setHeaders to change them.
Whether the body field should be serialized into JSON (and content-type
header should be set to application/json
).
Readonly
originalThe original Node.js object representing the response
An object {code, message}
, where each property is optional.
If code
is never given, a default value of 200
is applied.
Merge given headers
map with the previously set headers (initial set is an empty map).
Optional
headers: Readonly<IncomingHttpHeaders>Headers to set. Each header value can be a number, a string, or an array of strings. Put a null
value to suppress a header
A handier wrapper around a server response