feat: layered and scoped middleware and context state (#139)
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
co-authored by
Luca Casonato
parent
b36f2c1a43
commit
8d4e77f4ac
@@ -1,7 +1,8 @@
|
||||
import { MiddlewareHandlerContext } from "../server_deps.ts";
|
||||
|
||||
export async function handler(_req: Request, ctx: MiddlewareHandlerContext) {
|
||||
const resp = await ctx.handle();
|
||||
ctx.state.root = "root_mw";
|
||||
const resp = await ctx.next();
|
||||
resp.headers.set("server", "fresh test server");
|
||||
return resp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user