Cloudflare HTTP headers · Cloudflare Fun...

Hi, all.

I'm playing with the context workers and I have a few questions:

export default {
    async fetch(request, env ): Promise<Response> {
        const { system, client, headers } = await request.json() as Response;

  return new Response("test", { status: 200 });
},
} satisfies ExportedHandler<Env>;


  1. what is the correct type for the request, so the Typescript does not complain about `system` and `client`?The documentation isnt showing the TS version and everything that I tried - fails. Or should I write the types manually (I will do that for now, of course).
  2. Are there any ways how to get the `headers` values from the incoming request? Or is there a way how to get them in the Zaraz context? Everything I try either returns null values.
I am talking about this part of the headers: https://developers.cloudflare.com/fundamentals/reference/http-headers/
Cloudflare Docs
Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below.
Was this page helpful?