1 of 20
2 of 20
3 of 20
4 of 20
5 of 20
6 of 20
7 of 20
8 of 20
9 of 20
10 of 20
11 of 20
12 of 20
13 of 20
14 of 20
15 of 20
16 of 20
17 of 20
18 of 20
19 of 20
20 of 20

doc

Fetch API

How it works

The Fetch API provides an interface for fetching resources from the edge network, such as external resources across the network.

Fetch provides a generic definition of Request and Response objects. It allows them to handle or modify requests and responses or any kind of use case that may require you to generate your responses programmatically.

It also defines related concepts like CORS and the HTTP Origin header semantics, supplanting its separate definitions elsewhere.

Constructor

  fetch() Promise<response>

Properties

request: request string - the request object or string that represents the URL to fetch.

init: requestInit - the content of the request.

Example

  addEventListener("fetch", event => {
    return event.respondWith(
      fetch("https://example.com")
    )
  })

For more information on Fetch API visit MDN Web Docs.


Didn’t find what you were looking for? Open a support ticket.