Skip to main content
Version: 1.15

FetchResponse

FetchResponse class represents responses received from fetchRequest.fetch(urlOrRequest[, options]).

fetchResponse.body()#

Returns the buffer with response body.

fetchResponse.dispose()#

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

fetchResponse.headers()#

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

fetchResponse.headersArray()#

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.

fetchResponse.json()#

Returns the JSON representation of response body.

This method will throw if the response body is not parsable via JSON.parse.

fetchResponse.ok()#

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

fetchResponse.status()#

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

fetchResponse.statusText()#

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

fetchResponse.text()#

Returns the text representation of response body.

fetchResponse.url()#

Contains the URL of the response.