Request
Extends
Body
Implements
Constructors
new Request()
new Request(input
, init
): Request
Parameters
Parameter | Type |
---|---|
input | string | URL | Request |
init | RequestInit |
Returns
Overrides
Body.constructor
Properties
Property | Type | Description | Inherited from |
---|---|---|---|
body | null | ReadableStream <Uint8Array > | MDN Reference | globalThis.Request.body Body.body |
bodyUsed | boolean | MDN Reference | globalThis.Request.bodyUsed Body.bodyUsed |
cache | RequestCache | Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching. MDN Reference | - |
credentials | RequestCredentials | Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. MDN Reference | - |
destination | RequestDestination | Returns the kind of resource requested by request, e.g., "document" or "script". MDN Reference | - |
headers | Headers | - | globalThis.Request.headers Body.headers |
integrity | string | Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI] MDN Reference | - |
keepalive | boolean | Returns a boolean indicating whether or not request can outlive the global in which it was created. | - |
method | string | Returns request's HTTP method, which is "GET" by default. MDN Reference | - |
mode | RequestMode | Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs. MDN Reference | - |
redirect | RequestRedirect | Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default. MDN Reference | - |
referrer | string | Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and "about:client" when defaulting to the global's default. This is used during fetching to determine the value of the Referer header of the request being made. MDN Reference | - |
referrerPolicy | ReferrerPolicy | Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer. MDN Reference | - |
signal | AbortSignal | Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler. MDN Reference | - |
url | string | Returns the URL of request as a string. MDN Reference | - |
Methods
arrayBuffer()
arrayBuffer(): Promise
<ArrayBuffer
>
Returns a promise that resolves with an ArrayBuffer representation of the body. If the body is null, it returns an empty ArrayBuffer.
Returns
Implementation of
globalThis.Request.arrayBuffer
Inherited from
Body.arrayBuffer
blob()
Returns a promise that resolves with a Blob representation of the body. The Blob's type will be the value of the 'content-type' header.
Returns
Implementation of
globalThis.Request.blob
Inherited from
Body.blob
clone()
clone(): Request
Returns
Implementation of
globalThis.Request.clone
formData()
Returns a promise that resolves with a FormData representation of the body.
If the body cannot be decoded as form data, it throws a TypeError
.
Returns
Implementation of
globalThis.Request.formData
Inherited from
Body.formData
json()
json(): Promise
<any
>
Returns a promise that resolves with a JSON representation of the body.
If the body cannot be parsed as JSON, it throws a SyntaxError
.
Returns
Promise
<any
>
Implementation of
globalThis.Request.json
Inherited from
Body.json
text()
text(): Promise
<string
>
Returns a promise that resolves with a text representation of the body.
Returns
Promise
<string
>
Implementation of
globalThis.Request.text
Inherited from
Body.text