Skip to content

Commit 692455f

Browse files
committed
log-error
1 parent efd1e92 commit 692455f

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/taskBouncer.test.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,23 @@ Deno.test("cors preflight", async () => {
6969
predicate: () => true,
7070
handler: () => Promise.resolve(),
7171
}]);
72-
const { status, headers } = await fetch(`${host}:${port}/hello`, {
73-
method: "OPTIONS",
74-
headers: {
75-
"Origin": "http://example.com",
76-
"Access-Control-Request-Method": "POST",
77-
},
78-
});
79-
assertEquals(status, 204);
80-
assertEquals(headers.get("Access-Control-Allow-Origin"), "*");
81-
assertEquals(
82-
headers.get("Access-Control-Allow-Methods"),
83-
"GET, POST, PUT, DELETE, OPTIONS",
84-
);
72+
try {
73+
const { status, headers } = await fetch(`${host}:${port}/hello`, {
74+
method: "OPTIONS",
75+
headers: {
76+
"Origin": "http://example.com",
77+
"Access-Control-Request-Method": "POST",
78+
},
79+
});
80+
assertEquals(status, 204);
81+
assertEquals(headers.get("Access-Control-Allow-Origin"), "*");
82+
assertEquals(
83+
headers.get("Access-Control-Allow-Methods"),
84+
"GET, POST, PUT, DELETE, OPTIONS",
85+
);
86+
} catch (e) {
87+
console.error("failed", e);
88+
throw new Error();
89+
}
8590
await closeServer(server);
8691
});

0 commit comments

Comments
 (0)