Edit in GitHubLog an issue

window.Request

Request class represents a resource request.

Since: v7.3.0

Request(input, options)

Throws:

  • TypeError If options.body exists and options.method is either "GET" or "HEAD".
ParamTypeDescription
input
string | Request
Defines the resource that you wish to fetch. This can either be: A string containing the URL of the resource you want to fetch. A Request object.
options
Object
'(Optional)' object containing any custom settings that you want to apply to the request.
options.method
string
Request method. The default is "GET".
options.headers
string | Headers
Any headers you want to add to your request.
options.body
Blob | ArrayBuffer | TypedArray | FormData | string | ReadableStream | URLSearchParams
Any body that you want add to your request.
options.credentials
string
Request credentials you want to use for the request. Either "omit" or "include".
options.signal
AbortSignal
AbortSignal object which can be used to abort a request.

body : ReadableStream

Read only ReadableStream object with the body contents that have been added to the request or null if body is null.

See: Request - body

bodyUsed : boolean

Read only Indicates whether the request body has been read yet.

See: Request - bodyUsed

credentials : string

Read only Indicates whether the user agent should send or receive cookies. Possible values are:

Copied to your clipboard
"omit": Never send or receive cookies.
"include": Always send cookies.

headers : Headers

Read only Headers object associated with the request.

See: Request - headers

method : string

Read only Request's method. Possible values are "GET", "POST", "HEAD", "PUT", "DELETE" and "OPTIONS".

See: Request - method

url : string

Read only URL of the request.

See: Request - url

arrayBuffer()

Reads the request body and returns it as a Promise that resolves with an ArrayBuffer.

Returns: Promise<ArrayBuffer> Promise that resolves with an ArrayBuffer.
See: Request - arrayBuffer

blob()

Reads the request body and returns it as a Promise that resolves with a Blob.

Returns: Promise<Blob> Promise that resolves with a Blob.
See: Request - blob

clone()

Creates a copy of the current request object.

Returns: Request - Copy of the request.
See: Request - clone

formData()

Reads the request body and returns it as a Promise that resolves with a FormData.

Returns: Promise<FormData> Promise that resolves with a FormData.
See: Request - formData

json()

Reads the request body and returns it as a Promise that resolves with the result of parsing the body text as JSON.

Returns: Promise<Object> Promise that resolves to JSON object.
See: Request - json

text()

Reads the request body and returns it as a Promise that resolves with a String decoded using UTF-8.

Returns: Promise<string> Promise that resolves with a String.
See: Request - text

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.