feat: pass ConnInfo to various handler contexts (#121)

This commit is contained in:
Leo Kettmeir
2022-03-09 19:16:08 +01:00
committed by GitHub
parent 8d689938cb
commit 67b3eb470e
7 changed files with 92 additions and 36 deletions
+14 -1
View File
@@ -3,7 +3,20 @@ import { assert, assertEquals, assertStringIncludes } from "./deps.ts";
import manifest from "./fixture_error/fresh.gen.ts";
const ctx = await ServerContext.fromManifest(manifest);
const router = ctx.handler();
const router = (req: Request) => {
return ctx.handler()(req, {
localAddr: {
transport: "tcp",
hostname: "127.0.0.1",
port: 80,
},
remoteAddr: {
transport: "tcp",
hostname: "127.0.0.1",
port: 80,
},
});
};
Deno.test("error page rendered", async () => {
const resp = await router(new Request("https://fresh.deno.dev/"));