elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.09k stars 193 forks source link

CORS not working correctly when aot is false #652

Open yikkwongwong opened 1 month ago

yikkwongwong commented 1 month ago

What version of Elysia.JS is running?

1.0.21

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

const app = new Elysia({
  aot: false
}).use(cors({
  credentials: true,
})).get("/", () => "Hello Elysia").listen(3000);

and do a curl localhost:3000 -X OPTIONS -v

Access-Control-Allow-Credentials header is not set in header. Upon digging @elysiajs/cors, app.headers(defaultHeaders) calls are not setting the headers when not in AOT mode.

What is the expected behavior?

CORS to be working properly with/ without AOT.

What do you see instead?

CORS only work properly with AOT.

Additional information

No response