Request
The Request() constructor creates a new Request object.
new Request(input);new Request(input, options);
Parameters
-
input
Defines the resource you wish to fetch. Can be one of the following:
- A string containing the resource you wish to fetch.
Request
object, effectively creating a copy.
-
options
(optional)An options object containing any other data to associate with the Request
-
method: (optional)
e.g.
GET
,POST
,PUT
,DELETE
. (Default isGET
) -
headers: (optional)
An object: containing either a
Headers
object or object literal withString
key/value pairs. -
body: (optional)
Any body that you want to add to your request: this can be an
ArrayBuffer
, aTypedArray
, aDataView
, aURLSearchParams
, string object or literal, or aReadableStream
object.
-