JavaScript Runtime APIs - Request
The Request
interface represents an HTTP request and integrates the Fetch API.
How it works
The Request object can be built and also seen as the property of a fetchevent received by edge function.
Constructor
Parameters
Input
: string | Request
- defines the resource you want to search for by using a URL or Request object.
Init
: RequestInit
- optional
Properties
All properties of an initial Request object in event.request are defined as read-only. To modify a request, you must create a new Request object and pass the options to the builder, described as follows.
headers
- contains an Headers object.
method
- contains the request method - GET, POST, for example.
url
- contains the URL request.
body
- a simple” getter “to read the body’s contents through the ReadableStream interface.
bodyUsed
- stores a Boolean that declares whether the request body has already been used in a response.
redirect
- contains the redirection mode to use: follow, error, or manual.
event.type
: string
event.request
: request
For more information on Request visit MDN Web Docs.