Options
All
  • Public
  • Public/Protected
  • All
Menu

Response class represents responses which are received by page.

Hierarchy

  • Response

Index

Methods

buffer

  • buffer(): Promise<Buffer>
  • Promise which resolves to a buffer with response body.

    Returns Promise<Buffer>

frame

  • A Frame that initiated this response, or null if navigating to error pages.

    Returns null | Frame

fromCache

  • fromCache(): boolean
  • True if the response was served from either the browser's disk cache or memory cache.

    Returns boolean

fromServiceWorker

  • fromServiceWorker(): boolean
  • True if the response was served by a service worker.

    Returns boolean

headers

  • headers(): Record<string, string>
  • An object with HTTP headers associated with the response. All header names are lower-case.

    Returns Record<string, string>

json

  • json(): Promise<unknown>
  • Promise which resolves to a JSON representation of response body.

    throws

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

    Returns Promise<unknown>

ok

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

    Returns boolean

remoteAddress

  • Returns remote connection info

    Returns RemoteInfo

request

  • A matching Request object.

    Returns Request

securityDetails

  • Returns an object with security details associated with the response.

    Returns null | SecurityDetails

status

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

    Returns number

statusText

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

    Returns string

text

  • text(): Promise<string>
  • Promise which resolves to a text representation of response body.

    Returns Promise<string>

url

  • url(): string
  • Contains the URL of the response.

    Returns string

Generated using TypeDoc