chore: add test for middleware error handling (#1453)

This commit is contained in:
Reed von Redwitz
2023-07-12 10:12:43 +02:00
committed by GitHub
parent 0d141b7153
commit 46ae49d654
4 changed files with 70 additions and 20 deletions
+18
View File
@@ -652,6 +652,24 @@ Deno.test("middleware destination", async (t) => {
});
});
Deno.test({
name: "middleware catch error",
fn: async () => {
const resp = await handler(
new Request(
"https://fresh.deno.dev/middleware-error-handler",
),
);
assert(resp);
assertEquals(resp.status, Status.InternalServerError);
const body = await resp.text();
assertStringIncludes(
body,
"500 internal error: don't show the full error for security purposes",
);
},
});
Deno.test("experimental Deno.serve", {
sanitizeOps: false,
sanitizeResources: false,