feat: add ctx.renderNotFound() to explicitly render 404 template (#481)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Steven Yung
2022-08-09 19:23:17 +00:00
committed by GitHub
co-authored by Luca Casonato
parent b169d18ecb
commit 49092ed83a
6 changed files with 70 additions and 10 deletions
+11
View File
@@ -392,3 +392,14 @@ Deno.test({
assertEquals(resp.headers.get("server"), "fresh test server");
},
});
Deno.test({
name: "/not_found",
fn: async () => {
const resp = await router(new Request("https://fresh.deno.dev/not_found"));
assert(resp);
assertEquals(resp.status, 404);
const body = await resp.text();
assertStringIncludes(body, "404 not found: /not_found");
},
});