Skip to content

Commit c2b92d5

Browse files
committed
fix: Accept CORS requests correctly
1 parent 77e4b27 commit c2b92d5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@aklinker1/zero-ioc": "^1.3.2",
19-
"@aklinker1/zeta": "npm:@jsr/aklinker1__zeta@0.2.7",
19+
"@aklinker1/zeta": "npm:@jsr/aklinker1__zeta@0.2.8",
2020
"consola": "^3.2.3",
2121
"dataloader": "^2.2.2",
2222
"graphql": "^16.8.0",

src/plugins/cors-plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { createApp } from "@aklinker1/zeta";
22

33
export const corsPlugin = createApp()
4-
.onRequest(({ method, set }) => {
4+
.onRequest(async ({ method, set }) => {
55
set.headers["Access-Control-Allow-Origin"] = "*";
66
set.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS";
77
set.headers["Access-Control-Allow-Headers"] = "*";
88
if (method === "OPTIONS") {
99
set.status = 204;
10+
return new Response(undefined, set);
1011
}
1112
})
1213
.export();

0 commit comments

Comments
 (0)