ProtocolResponse Object
-
error
Integer (optional) - When assigned, therequest
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"
. -
mimeType
String (optional) - The MIME type of response body, default is"text/html"
. SettingmimeType
would implicitly set thecontent-type
header in response, but ifcontent-type
is already set inheaders
, themimeType
would be ignored. -
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. -
url
String (optional) - Download theurl
and pipe the result as response body. This is only used for URL 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. -
uploadData
ProtocolResponseUploadData (optional) - The data used as upload data. This is only used for URL responses whenmethod
is"POST"
.
© GitHub Inc.
Licensed under the MIT license.
https://www.electronjs.org/docs/latest/api/structures/protocol-response