The result of a resource retrieval.

Hierarchy

Constructors

Properties

headers: Headers = ...
statusText: string = ''
url: string = null

Accessors

  • get body(): BodyType
  • Retrieve the contents of the body.

    Returns BodyType

  • get bodyUsed(): boolean
  • Check if the contents of the body have been consumed.

    Returns boolean

  • get ok(): boolean
  • Check if this response is a result of successful request.

    Returns boolean

  • get status(): number
  • Get the HTTP status code, e.g. 200

    Returns number

Methods

  • Returns Promise<ArrayBuffer>

  • Consume the contents of the body as JSON.

    Returns Promise<any>

  • Consume the contents of the body as text.

    Returns Promise<string>

  • Create a new response that represents a network error.

    Returns Response

  • Create a new response, whose body is JSON-encoded data

    Parameters

    • data: any

      JSON-encoded body of the response

    • Optional init: ResponseInit

      additional response metadata

    Returns Response