Request()
The Request()
constructor creates a new
Request
object.
Syntax
new Request(input)
new Request(input, options)
Parameters
input
: Defines the resource that you wish to fetch. This can either be:
- A string containing the direct URL of the resource you want to fetch.
- A
Request
object, effectively creating a copy.
options
optional: An object containing any custom settings that you want to apply to the request. The possible options are:
method
- : The request method, e.g.,
GET
,POST
. The default isGET
.
- : The request method, e.g.,
headers
- : Any headers you want to add to your request, contained
within a
Headers
object or an object literal withString
values.
- : Any headers you want to add to your request, contained
within a
body
- : 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.
- : Any body that you want to add to your request: this can be an
backend
Fastly-specificcacheOverride
Fastly-specificcacheKey
Fastly-specificfastly
Fastly-specificdecompressGzip
: boolean optional- Whether to automatically gzip decompress the Response or not.