You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
I found a really weird behavior where after posting to /login aka logging in and having an auth cookie, I wasn't able to access any query variables while trying to access the cookies. c.cookie is undefined if c.query.id is accessed. Maybe I'm missing out on something, but this looks like weird and incorrect behavior.
Example:
import{Elysia,t}from'elysia';import{jwt}from'@elysiajs/jwt';import{swagger}from'@elysiajs/swagger';constapp=newElysia({name: 'Example'}).use(jwt({name: 'jwt',secret: 'secret'})).use(swagger()).get('/',async(c)=>{// const id = c.query.id; // -> uncommenting me will make c.cookie undefinedconstcookie=c.cookie;console.log('cookie',cookie);return{abc: 'abc', cookie };},{query: t.Object({id: t.Optional(t.String({minLength: 21,maxLength: 21}))})}).post('/login',async(c)=>{c.cookie.auth.set({value: awaitc.jwt.sign({random: 'random'}),httpOnly: true,maxAge: 7*86400,path: '/'});return{name: 'user'};},{body: t.Object({name: t.String(),password: t.String()}),detail: {tags: ['Auth'],summary: 'Login'}}).listen(3001);
What is the expected behavior?
I'd expect to have c.cookie not be undefined.
What do you see instead?
c.cookie is undefined if c.query.variable is accessed.
Additional information
No response
The text was updated successfully, but these errors were encountered:
What version of Elysia.JS is running?
Elysia v1.0.14
What platform is your computer?
Linux 6.7.9-200.fc39.x86_64 x86_64 unknown
What steps can reproduce the bug?
Description:
I found a really weird behavior where after posting to
/login
aka logging in and having an auth cookie, I wasn't able to access any query variables while trying to access the cookies.c.cookie
is undefined ifc.query.id
is accessed. Maybe I'm missing out on something, but this looks like weird and incorrect behavior.Example:
What is the expected behavior?
I'd expect to have
c.cookie
not be undefined.What do you see instead?
c.cookie
is undefined ifc.query.variable
is accessed.Additional information
No response
The text was updated successfully, but these errors were encountered: