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

Using Args

Check below how call an argument:

The first example (Code tab) depicts how you can enable the use of args by using event.args.<ARG_CREATED> . The second example (Args tab) represents the use of JSON parameters by internal code functions.

Code tab

  async function handleRequest(request, v) {
          return new Response(v, {
              headers: new Headers([
                  ["X-Custom-Header", "something defined on JS"],
              ]),
              status: 200,
          });
      }
      addEventListener("fetch", (event) => {
          event.respondWith(handleRequest(event.request, event.args.value));
      });

Args tab

{
    "value": "hello_world"
}

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