-
-
Notifications
You must be signed in to change notification settings - Fork 461
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.21
What platform is your computer?
No response
What environment are you using
No response
Are you using dynamic mode?
No response
What steps can reproduce the bug?
It is breaking cors plugin.
Something like this:
import { Elysia, sse, status } from 'elysia'
const app = new Elysia()
.get('/fail', async function* ({ set }) {
set.headers["access-control-allow-origin"] = "*";
throw status(500);
})
.get('/work', async function* ({ set }) {
set.headers["access-control-allow-origin"] = "*";
return status(500); // <- returns
})
.listen(3000)import { app } from '../server'
import { treaty } from '@elysiajs/eden'
const api = treaty(app);
(async () => {
const fail = await api.fail.get();
console.log("fail.headers", fail.headers);
const work = await api.work.get();
console.log("work.headers", work.headers);
})();What is the expected behavior?
headers to be sent, cors plugin to work.
What do you see instead?
headers not sent.
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working