Class “Request”

Object > Request

Represents an HTTP Request as used by fetch().

Type: Request extends Object
Constructor: public
Singleton: No
Namespace: global
Direct subclasses: None
JSX Support: No

Constructor

new Request(input, init?)

Parameter Type Description
input string | Request  
init object Optional.
init.body Blob
| FormData
| string
The body of the request. GET or HEAD requests can not have a body. Optional.
init.cache string Optional.
init.credentials string Optional.
init.headers Headers
| Array<[string, string]>
| {[header]: string}
The headers to add to the request. Optional.
init.method string The request method, e.g., 'GET', 'POST'. Optional.
init.mode string Optional.

Methods

arrayBuffer()

Returns: Promise<ArrayBuffer>

blob()

Returns: Promise<Blob>

clone()

Returns: Request

json()

Returns: Promise<any>

text()

Returns: Promise<string>

Properties

bodyUsed

Type: boolean
Settable: No

cash

Type: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'
Settable: No

context

Type: 'audio' | 'beacon' | 'cspreport' | 'download' | 'embed' | 'eventsource' | 'favicon' | 'fetch' | 'font' | 'form' | 'frame' | 'hyperlink' | 'iframe' | 'image' | 'imageset' | 'import' | 'internal' | 'location' | 'manifest' | 'object' | 'ping' | 'plugin' | 'prefetch' | 'script' | 'serviceworker' | 'sharedworker' | 'subresource' | 'style' | 'track' | 'video' | 'worker' | 'xmlhttprequest' | 'xslt'
Settable: No

credentials

Type: 'omit' | 'same-origin' | 'include'
Settable: No

headers

Type: Headers
Settable: No

method

Type: string
Settable: No

mode

Type: 'same-origin' | 'no-cors' | 'cors'
Settable: No

referrer

Type: string
Settable: No

url

Type: string
Settable: No