mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-23 02:23:26 +01:00
22 lines
407 B
TypeScript
22 lines
407 B
TypeScript
|
type Env = {
|
||
|
SECRET1?: string;
|
||
|
SECRET2?: string;
|
||
|
};
|
||
|
|
||
|
export default {
|
||
|
fetch(request: Request, env: Env) {
|
||
|
const url = new URL(request.url);
|
||
|
|
||
|
if (url.pathname === "/secret") {
|
||
|
const { SECRET1 = "", SECRET2 = "" } = env;
|
||
|
return new Response(`${SECRET1} ${SECRET2}`);
|
||
|
}
|
||
|
|
||
|
// @ts-expect-error
|
||
|
return Response.json({
|
||
|
...request,
|
||
|
headers: Object.fromEntries(request.headers),
|
||
|
});
|
||
|
},
|
||
|
};
|