ProtocolResponse Type
Constructors
| Constructor |
Description
|
Full Usage:
ProtocolResponse(?error, ?statusCode, ?charset, ?mimeType, ?headers, ?data, ?path, ?url, ?referrer, ?method, ?session, ?uploadData)
Parameters:
int
-
When assigned, the request will fail with the error number . For the available error numbers you can use,
please see the net error list.
?statusCode : float
-
The HTTP response code, default is 200.
?charset : string
-
The charset of response body, default is "utf-8".
?mimeType : string
-
The MIME type of response body, default is "text/html". Setting mimeType would implicitly set the content-type header in response,
but if content-type is already set in headers, the mimeType would be ignored.
?headers : Record<string, U2<string, string[]>>
-
An object containing the response headers. The keys must be string, and values must be either string or Array
of string.
?data : U3<Buffer, string, Readable<obj>>
-
The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When
returning Buffer as response, this is a Buffer. When returning string as response, this is a string. This is ignored
for other types of responses.
?path : string
-
Path to the file which would be sent as response body. This is only used for file responses.
?url : string
-
Download the url and pipe the result as response body. This is only used for URL responses.
?referrer : string
-
The referrer URL. This is only used for file and URL responses.
?method : string
-
The HTTP method. This is only used for file and URL responses.
?session : Session
-
The session used for requesting URL. The HTTP request will reuse the current session by default.
?uploadData : ProtocolResponseUploadData
-
The data used as upload data. This is only used for URL responses when method is "POST".
Returns: ProtocolResponse
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.charset
|
The charset of response body, default is "utf-8". |
Full Usage:
this.data
|
The response body. When returning stream as response, this is a Node.js readable stream representing the response body. When returning Buffer as response, this is a Buffer. When returning string as response, this is a string. This is ignored for other types of responses. |
Full Usage:
this.error
|
When assigned, the request will fail with the error number . For the available error numbers you can use, please see the net error list. |
Full Usage:
this.headers
|
An object containing the response headers. The keys must be string, and values must be either string or Array of string. |
Full Usage:
this.method
|
The HTTP method. This is only used for file and URL responses. |
Full Usage:
this.mimeType
|
The MIME type of response body, default is "text/html". Setting mimeType would implicitly set the content-type header in response, but if content-type is already set in headers, the mimeType would be ignored. |
Full Usage:
this.path
|
Path to the file which would be sent as response body. This is only used for file responses. |
Full Usage:
this.referrer
|
The referrer URL. This is only used for file and URL responses. |
Full Usage:
this.session
|
The session used for requesting URL. The HTTP request will reuse the current session by default. |
Full Usage:
this.statusCode
|
The HTTP response code, default is 200. |
Full Usage:
this.uploadData
|
The data used as upload data. This is only used for URL responses when method is "POST". |
Full Usage:
this.url
|
Download the url and pipe the result as response body. This is only used for URL responses. |
fable-electron-docs-api