2021-10-19 11:17:23 -07:00
|
|
|
# class: APIResponse
|
2021-11-09 14:04:34 +01:00
|
|
|
* langs: js, python
|
2021-09-10 18:36:55 -07:00
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
[APIResponse] class represents responses returned by [`method: APIRequestContext.get`] and similar methods.
|
2021-09-10 18:36:55 -07:00
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## async method: APIResponse.body
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[Buffer]>
|
|
|
|
|
|
|
|
Returns the buffer with response body.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## async method: APIResponse.dispose
|
2021-09-10 18:36:55 -07:00
|
|
|
|
|
|
|
Disposes the body of this response. If not called then the body will stay in memory until the context closes.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.headers
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[Object]<[string], [string]>>
|
|
|
|
|
|
|
|
An object with all the response HTTP headers associated with this response.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.headersArray
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[Array]<[Object]>>
|
|
|
|
- `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.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## async method: APIResponse.json
|
2021-09-10 18:36:55 -07:00
|
|
|
* langs: js, python
|
|
|
|
- returns: <[Serializable]>
|
|
|
|
|
|
|
|
Returns the JSON representation of response body.
|
|
|
|
|
|
|
|
This method will throw if the response body is not parsable via `JSON.parse`.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## async method: APIResponse.json
|
2021-09-10 18:36:55 -07:00
|
|
|
* langs: csharp
|
|
|
|
- returns: <[null]|[JsonElement]>
|
|
|
|
|
|
|
|
Returns the JSON representation of response body.
|
|
|
|
|
|
|
|
This method will throw if the response body is not parsable via `JSON.parse`.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.ok
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[boolean]>
|
|
|
|
|
|
|
|
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.status
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[int]>
|
|
|
|
|
|
|
|
Contains the status code of the response (e.g., 200 for a success).
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.statusText
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[string]>
|
|
|
|
|
|
|
|
Contains the status text of the response (e.g. usually an "OK" for a success).
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## async method: APIResponse.text
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[string]>
|
|
|
|
|
|
|
|
Returns the text representation of response body.
|
|
|
|
|
2021-10-19 11:17:23 -07:00
|
|
|
## method: APIResponse.url
|
2021-09-10 18:36:55 -07:00
|
|
|
- returns: <[string]>
|
|
|
|
|
|
|
|
Contains the URL of the response.
|