Optional
bodyA string or buffer, which replaces the request body if set. This will be automatically content-encoded to match the Content-Encoding defined in your request headers.
If this is set, the Content-Length header will be automatically updated
accordingly to match, unless you also provide a headers
value that
includes a Content-Length header, in which case that will take used
as-is.
You should only return one body field: either body
, rawBody
or
json
.
Optional
headersThe replacement HTTP headers, as an object of string keys and either single string or array of string values.
Optional
jsonA JSON value, which will be stringified and send as a JSON-encoded request body. This will be automatically content-encoded to match the Content-Encoding defined in your request headers.
If this is set, the Content-Length header will be automatically updated
accordingly to match, unless you also provide a headers
value that
includes a Content-Length header, in which case that will take used
as-is.
You should only return one body field: either body
, rawBody
or
json
.
Optional
methodA replacement HTTP method, capitalized.
Optional
rawA buffer, which replaces the request body if set, which is sent exactly as is, and is not automatically encoded.
If this is set, the Content-Length header will be automatically updated
accordingly to match, unless you also provide a headers
value that
includes a Content-Length header, in which case that will take used
as-is.
You should only return one body field: either body
, rawBody
or
json
.
Optional
responseA response: either a response object defining the fields of a response or the string 'close' to immediately close the connection.
See CallbackResponseMessageResult for the possible fields that can be set to define the response.
If set, the request will not be forwarded at all, and this will be used as the response to immediately return to the client (or for 'close', this will immediately close the connection to the client).
Optional
urlThe full URL to send the request to. If set, this will redirect
the request and automatically update the Host header accordingly,
unless you also provide a headers
value that includes a Host
header, in which case that will take used as-is.
Can be returned from callbacks to override parts of a request.
All fields are optional, and omitted values will default to the original request value.