> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Modify HTTP headers

> For scenarios requiring modification of HTTP headers, such as enforcing certain request methods or setting custom response headers, this example demonstrates handling only GET requests and responding with a JSON object. See example below:

```ts theme={null}
import * as BunnySDK from "@bunny.net/edgescript-sdk";

BunnySDK.net.http.serve(
  async (request: Request): Response | Promise<Response> => {
    const url = new URL(request.url);
    if (request.method !== "GET")
      return new Response("Not Allowed", {
        status: 405,
        headers: {
          Allow: "GET",
        },
      });

    const responseObj = {
      hello: "world",
    };

    return new Response(JSON.stringify(responseObj), {
      headers: {
        "Content-type": "application/json",
      },
    });
  },
);
```
