feat: support overwriting default 404 handler (#3081)

Fixes https://github.com/denoland/fresh/issues/1918
This commit is contained in:
Marvin Hagemeister
2025-07-09 00:40:12 +02:00
committed by GitHub
parent ec2bb17589
commit 0b3546f201
2 changed files with 20 additions and 2 deletions
+12
View File
@@ -532,3 +532,15 @@ Deno.test("FreshApp - adding Island should convert to valid export names", () =>
fn: component3,
});
});
Deno.test("FreshApp - overwrite default 404 handler", async () => {
const app = new App().get("/foo", () => new Response("foo"));
const server = new FakeServer(
app.handler(() => Promise.resolve(new Response("bar"))),
);
const res = await server.get("/invalid");
const text = await res.text();
expect(text).toEqual("bar");
});