class Request

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

A request to be sent with fetch().

The URL must be an absolute http:// or https:// URL.

Index

Constructors

Properties

Methods

new Request(input, init)

new Request(input: string | Request, init?: RequestInit);

Constructs a new instance of the Request class

ParameterTypeDescription
inputstring | Requestan absolute URL string or another Request to copy.
optional initRequestInitrequest options.

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 of the body, or null.

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 request (tee-based; throws once the body is consumed).

clone(): Request;
NameTypeDescription
Return ValueRequest

credentials RequestCredentials read-only

The credentials mode.

duplex string read-only

The duplex mode for streamed bodies.

formData()

Reads the body as FormData (urlencoded or buffered multipart).

formData(): Promise<FormData>;
NameTypeDescription
Return ValuePromise<FormData>

headers Headers read-only

The request headers.

json()

Reads and parses the body as JSON.

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

method string read-only

The HTTP method.

redirect RequestRedirect read-only

The redirect mode.

signal AbortSignal read-only

The associated abort signal, if any.

text()

Reads the body as a UTF-8 string.

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

url string read-only

The request URL.