@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 13 lines 493 Bytes
Raw
1 import type { MiddlewareHandler } from "astro";
2
3 /**
4 * Astro middleware: runs inside workerd for on-demand routes (dev + live).
5 * Exercises both middleware surfaces — writing `Astro.locals` (read by
6 * `/locals`) and mutating the outgoing response headers.
7 */
8 export const onRequest: MiddlewareHandler = async (context, next) => {
9 context.locals.fromMiddleware = "set-by-middleware";
10 const response = await next();
11 response.headers.set("x-middleware", "hit");
12 return response;
13 };