Skip to content

Commit

Permalink
log-error
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Nov 23, 2024
1 parent efd1e92 commit 692455f
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/taskBouncer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ Deno.test("cors preflight", async () => {
predicate: () => true,
handler: () => Promise.resolve(),
}]);
const { status, headers } = await fetch(`${host}:${port}/hello`, {
method: "OPTIONS",
headers: {
"Origin": "http://example.com",
"Access-Control-Request-Method": "POST",
},
});
assertEquals(status, 204);
assertEquals(headers.get("Access-Control-Allow-Origin"), "*");
assertEquals(
headers.get("Access-Control-Allow-Methods"),
"GET, POST, PUT, DELETE, OPTIONS",
);
try {
const { status, headers } = await fetch(`${host}:${port}/hello`, {
method: "OPTIONS",
headers: {
"Origin": "http://example.com",
"Access-Control-Request-Method": "POST",
},
});
assertEquals(status, 204);
assertEquals(headers.get("Access-Control-Allow-Origin"), "*");
assertEquals(
headers.get("Access-Control-Allow-Methods"),
"GET, POST, PUT, DELETE, OPTIONS",
);
} catch (e) {
console.error("failed", e);
throw new Error();
}
await closeServer(server);
});

0 comments on commit 692455f

Please sign in to comment.