Skip to main content
Version: 1.0.1

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 is GET.
      • headers
        • : Any headers you want to add to your request, contained within a Headers object or an object literal with String values.
      • body
        • : Any body that you want to add to your request: this can be an ArrayBuffer, a TypedArray, a DataView, a URLSearchParams, string object or literal, or a ReadableStream object.
      • backend Fastly-specific
        • A string which is the name of the Fastly configured backend the request should be sent to.
      • cacheOverride Fastly-specific
      • cacheKey Fastly-specific