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
| Parameter | Type | Description |
|---|---|---|
| input | string | Request | an absolute URL string or another Request to copy. |
| optional init | RequestInit | request options. |
arrayBuffer()
Reads the body as an ArrayBuffer.
arrayBuffer(): Promise<ArrayBuffer>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<ArrayBuffer> |
blob()
Reads the body as a Blob using the current content-type.
blob(): Promise<Blob>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<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>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<buffer.IOBuffer> |
clone()
Clones the request (tee-based; throws once the body is consumed).
clone(): Request;
| Name | Type | Description |
|---|---|---|
| Return Value | Request |
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>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<FormData> |
headers Headers read-only
The request headers.
json()
Reads and parses the body as JSON.
json(): Promise<any>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<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>;
| Name | Type | Description |
|---|---|---|
| Return Value | Promise<string> |
url string read-only
The request URL.