ProtocolResponse Object
- Integer(可选的) - 如果赋值,
request
将会失败,并返回error
错误码。 更多的错误号信息,您可以查阅. statusCode
Number (可选的) - HTTP响应码,默认是200。charset
String (可选) - 响应体的字符集, 默认值为"utf-8"
.headers
Record<string, string | string[]> (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.