Set cookie from a resource
If I'm using a createResource function that is calling an api which is returning a set-cookie header how can i add the cookies to the browser if the cookie container httponly
5 Replies
if the cookie is httpOnly then you can't access it in js, but it should still be saved to the browser for you. not sure i understand the question?
Ahh.. in my browser it's not even saved 😄
Is there any way to add dynamic headers on pageload to the response ?
if the server is responding with the header but not saving it that seems like a cookie configuration issue, those suck to deal with heh
try appendResponseHeader from vinxi
Ahhh good one i will give that a try. Thanks 🙏
1. On the server side use
getRequestEvent()
to obtain the RequestEvent
.
2. Being also a FetchEvent
there is a response
property which is basically a stub for information to be included with the real Response
once it is dispatched by the server.
3. That response
property has a headers
property which should be a Headers object (i.e. it satisfies the Headers interface).
4. Headers
has an append()
method.SolidStart Beta Documentation
SolidStart Beta Documentation
Early release documentation and resources for SolidStart Beta
GitHub
solid-start/packages/start/src/server/types.ts at b75fa978660d6353b...
SolidStart, the Solid app framework. Contribute to solidjs/solid-start development by creating an account on GitHub.