APIResponse
Added in: v1.16APIResponse class represents responses returned by apiRequestContext.get() and similar methods.
Methods
apiResponse.body()
Added in: v1.16Returns the buffer with response body.
Returns
Buffer
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.
Returns
Object<string, string>
apiResponse.headersArray()
Added in: v1.16An array with all the response 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.
Returns
Array<Object>
apiResponse.ok()
Added in: v1.16Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
Returns
boolean
apiResponse.securityDetails()
Added in: v1.61Returns SSL and other security information. Resolves to null for non-HTTPS responses. For redirected requests, returns the information for the last request in the redirect chain.
Returns
null | Object
apiResponse.serverAddr()
Added in: v1.61Returns the IP address and port of the server. Resolves to null if the server address is not available. For redirected requests, returns the information for the last request in the redirect chain.
Returns
null | Object
apiResponse.status()
Added in: v1.16Contains the status code of the response (e.g., 200 for a success).
Returns
int
apiResponse.statusText()
Added in: v1.16Contains the status text of the response (e.g. usually an "OK" for a success).
Returns
string
apiResponse.text()
Added in: v1.16Returns the text representation of response body.
Returns
string
apiResponse.timing()
Added in: v1.62Returns resource timing information for given response. For redirected requests, returns the information for the last request in the redirect chain. When the response is served from the HAR file, timing information is not available and all the values are -1. Find more information at Resource Timing API.
Returns
Object
apiResponse.url()
Added in: v1.16Contains the URL of the response.
Returns
string