feat: support custom error pages (#86)
This commit is contained in:
@@ -123,6 +123,8 @@ Deno.test("/api/xyz not found", async () => {
|
||||
const resp = await router(new Request("https://fresh.deno.dev/api/xyz"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, 404);
|
||||
const body = await resp.text();
|
||||
assert(body.includes("404 not found: /api/xyz"));
|
||||
});
|
||||
|
||||
Deno.test("/static page prerender", async () => {
|
||||
@@ -160,3 +162,11 @@ Deno.test("redirect /pages/fresh/ to /pages/fresh", async () => {
|
||||
"https://fresh.deno.dev/pages/fresh",
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("/failure", async () => {
|
||||
const resp = await router(new Request("https://fresh.deno.dev/failure"));
|
||||
assert(resp);
|
||||
assertEquals(resp.status, 500);
|
||||
const body = await resp.text();
|
||||
assert(body.includes("500 internal error: it errored!"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user