Shadow endpoints can't set cookies and redirect, but standalone endpoints can - is this a bug? #3739
-
I have some code in a shadow endpoint that does some logic and either renders the matching page or sets a cookie and redirects elsewhere. This worked fine in older versions of Kit but since shadow endpoints have become a thing it no longer sets the cookie. If I rename the endpoint so that it is not a shadow one then it works (i.e. sets the cookie) but this seems less than elegant as in some cases I still want to fall through to the previously matching .svelte route. I can't see a reason why it would be OK to set cookies on standalone endpoints but not shadow ones. From munging tests within kit itself I can see that this behavour only occurs when redirecting now - the cookie is set fine if you just fall through. Simplified version of my redirect code in the endpoint... return {
status: 303,
headers: {
'set-cookie': 'foo=bar; HttpOnly',
location: '/'
}
} Am I doing this wrong, or should this work? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
yeah, I think it is... |
Beta Was this translation helpful? Give feedback.
-
This seems like the same issue I reported: #3758 |
Beta Was this translation helpful? Give feedback.
This seems like the same issue I reported: #3758