ProtocolResponse Object
- Integer (optional) - When assigned, the
request
will fail with theerror
number . For the available error numbers you can use, please see the net error list. statusCode
number (optional) - The HTTP response code, default is 200.charset
string (optional) - The charset of response body, default is"utf-8"
.headers
Record(optional) - An object containing the response headers. The keys must be string, and values must be either string or Array of string. data
(Buffer | string | ReadableStream) (optional) - The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returningBuffer
as response, this is aBuffer
. When returningstring
as response, this is astring
. This is ignored for other types of responses.path
string (optional) - Path to the file which would be sent as response body. This is only used for file responses.referrer
string (optional) - Thereferrer
URL. This is only used for file and URL responses.method
string (optional) - The HTTPmethod
. This is only used for file and URL responses.session
Session (optional) - The session used for requesting URL, by default the HTTP request will reuse the current session. Settingsession
tonull
would use a random independent session. This is only used for URL responses.