ProtocolResponse

external interface ProtocolResponse(source)

Properties

Link copied to clipboard
abstract external var charset: String?

The charset of response body, default is "utf-8".

Link copied to clipboard
abstract external var data: Any?

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.

Link copied to clipboard
abstract external var error: Double?

When assigned, the request will fail with the error number . For the available error numbers you can use, please see the net error list.

Link copied to clipboard
abstract external var headers: ReadonlyRecord<String, Any>?

An object containing the response headers. The keys must be string, and values must be either string or Array of string.

Link copied to clipboard
abstract external var method: String?

The HTTP method. This is only used for file and URL responses.

Link copied to clipboard
abstract external var 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.

Link copied to clipboard
abstract external var path: String?

Path to the file which would be sent as response body. This is only used for file responses.

Link copied to clipboard
abstract external var referrer: String?

The referrer URL. This is only used for file and URL responses.

Link copied to clipboard
abstract external var session: Session?

The session used for requesting URL. The HTTP request will reuse the current session by default.

Link copied to clipboard
abstract external var statusCode: Double?

The HTTP response code, default is 200.

Link copied to clipboard
abstract external var uploadData: ProtocolResponseUploadData?

The data used as upload data. This is only used for URL responses when method is "POST".

Link copied to clipboard
abstract external var url: String?

Download the url and pipe the result as response body. This is only used for URL responses.