class Response

Supported only in the v8 engine. Introduced in Max v9.2.0.

A response returned by fetch().

Index

Constructors

Properties

Methods

new Response(body, init)

new Response(
  body?: BodyInit | null,
  init?: { status?: number; statusText?: string; headers?: HeadersInit },
);

Constructs a new instance of the Response class

ParameterTypeDescription
optional bodyBodyInit | nullthe response body.
optional initobjectresponse status and headers.
optional init.status number
optional init.statusText string
optional init.headers HeadersInit

arrayBuffer()

Reads the body as an ArrayBuffer.

arrayBuffer(): Promise<ArrayBuffer>;
NameTypeDescription
Return ValuePromise<ArrayBuffer>

blob()

Reads the body as a Blob using the current content-type.

blob(): Promise<Blob>;
NameTypeDescription
Return ValuePromise<Blob>

body ReadableStream | null read-only

A byte-oriented ReadableStream for incremental body consumption, or null. Canceling it aborts the underlying native transport.

bodyUsed boolean read-only

Whether the body has already been consumed.

bytes()

Reads the body as bytes.

bytes(): Promise<buffer.IOBuffer>;
NameTypeDescription
Return ValuePromise<buffer.IOBuffer>

clone()

Clones the response (tee-based; throws once the body is consumed).

clone(): Response;
NameTypeDescription
Return ValueResponse

headers Headers read-only

The response headers.

json()

Reads and parses the body as JSON.

json(): Promise<any>;
NameTypeDescription
Return ValuePromise<any>

ok boolean read-only

Whether Response.status is in the range 200–299.

status number read-only

The HTTP status code.

statusText string read-only

The HTTP status text.

text()

Reads the body as a UTF-8 string.

text(): Promise<string>;
NameTypeDescription
Return ValuePromise<string>

url string read-only

The final response URL after any redirects.