-
-
Notifications
You must be signed in to change notification settings - Fork 476
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.25
What platform is your computer?
Darwin 24.6.0 arm64 arm
What environment are you using
1.2.8
Are you using dynamic mode?
No
What steps can reproduce the bug?
When a route has a resolve that destructures the cookie, the redirect helper stops working. The endpoint returns a 200 response with an empty body instead of a 302 response containing the Location header.
Steps:
export const plugin = new Elysia()
.guard({
cookie: t.Cookie({
sessionToken: t.Optional(t.String()),
}),
})
.resolve({ as: 'global' }, ({ cookie }) => {
const sessionToken = cookie?.sessionToken?.value;
return { sessionToken };
});
const app = new Elysia().use(plugin).get('/redirect', ({ redirect }) => {
return redirect('https://google.com', 302); // <-- NOT WORKING
});
new Elysia().use(redirect).listen(3000);What is the expected behavior?
The header must contain the Location and the redirect status code.
What do you see instead?
[200] /redirect
Headers:
content-length 0
date Fri, 20 Feb 2026 19:59:32 GMT
Have you try removing the node_modules and bun.lockb and try again yet?
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working