Add API endpoint to return request headers as a gzipped JSON response
Some checks failed
Code quality checks / biome (push) Failing after 7s

This commit is contained in:
Seth 2025-05-04 14:45:35 -04:00
parent 424343e311
commit cf21a56d7a

View file

@ -155,6 +155,15 @@ const webserver = serve({
const request = new Request(req);
request.headers.delete('cookie');
return await fetch("https://plausible.creations.works/api/event", request);
},
"/api/headers": async (req) => {
return new Response(gzipSync(JSON.stringify({ headers: req.headers })), {
headers: {
"Content-Type": "application/json",
"Content-Encoding": "gzip",
"Cache-Control": "no-cache",
}
})
}
},
websocket: {