Skip to content

Interface: FetchResponse<T>

Defined in: api_types.ts:763

The response of a call to Fetcher.fetch.

The structure largely follows https://developer.mozilla.org/en-US/docs/Web/API/Response

Type Parameters

Type Parameter Default type
T extends any any

Properties

body?

optional body: T

Defined in: api_types.ts:777

The body of the response.

If the response contains JSON data, either because the Content-Type header is application/json or if the data is JSON-parsable, this will be a parsed JavaScript object. Similarly, if the response headers are text/xml or application/xml, this will be a parsed JavaScript object using the xml2js library.

If implicit parsing is undesirable, you may consider using FetchRequest.isBinaryResponse on the request to disable any parsing. Note however that this will result in the body being a NodeJS Buffer.


headers

headers: object

Defined in: api_types.ts:781

HTTP response headers. The contents of many headers will be redacted for security reasons.

Index Signature

[header: string]: string | string[] | undefined


status

status: number

Defined in: api_types.ts:765

The HTTP status code, e.g. 200.