Skip to main content

APIResponse

APIResponse class represents responses returned by APIRequestContext.get(url[, options]) and similar methods.

APIResponse.body()

Added in: v1.16

Returns the buffer with response body.

APIResponse.dispose()

Added in: v1.16

Disposes the body of this response. If not called then the body will stay in memory until the context closes.

APIResponse.headers()

Added in: v1.16

An object with all the response HTTP headers associated with this response.

APIResponse.headersArray()

Added in: v1.16
  • returns: <List<HttpHeader>>#
    • name <String> Name of the header.
    • value <String> Value of the header.

An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with multiple entries, such as Set-Cookie, appear in the array multiple times.

APIResponse.ok()

Added in: v1.16

Contains a boolean stating whether the response was successful (status in the range 200-299) or not.

APIResponse.status()

Added in: v1.16

Contains the status code of the response (e.g., 200 for a success).

APIResponse.statusText()

Added in: v1.16

Contains the status text of the response (e.g. usually an "OK" for a success).

APIResponse.text()

Added in: v1.16

Returns the text representation of response body.

APIResponse.url()

Added in: v1.16

Contains the URL of the response.