APIResponse
APIResponse class represents responses returned by apiRequestContext.get(url[, options]) and similar methods.
- apiResponse.body()
- apiResponse.dispose()
- apiResponse.headers()
- apiResponse.headersArray()
- apiResponse.json()
- apiResponse.ok()
- apiResponse.status()
- apiResponse.statusText()
- apiResponse.text()
- apiResponse.url()
apiResponse.body()
Added in: v1.16Returns the buffer with response body.
apiResponse.dispose()
Added in: v1.16Disposes the body of this response. If not called then the body will stay in memory until the context closes.
apiResponse.headers()
Added in: v1.16An object with all the response HTTP headers associated with this response.
apiResponse.headersArray()
Added in: v1.16An 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.json()
Added in: v1.16- returns:Promise<Serializable>># <
Returns the JSON representation of response body.
This method will throw if the response body is not parsable via JSON.parse
.
apiResponse.ok()
Added in: v1.16Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
apiResponse.status()
Added in: v1.16Contains the status code of the response (e.g., 200 for a success).
apiResponse.statusText()
Added in: v1.16Contains the status text of the response (e.g. usually an "OK" for a success).
apiResponse.text()
Added in: v1.16Returns the text representation of response body.
apiResponse.url()
Added in: v1.16Contains the URL of the response.