Set Cookie as post response?
See original GitHub issueIt could very well be that I am missing something basic here, but why cannot I set a cookie as a response to a cookie?
Here is my over simplified code that does not set a cookie for some reason:
app.post('*', (req,res) => { req.session.userName = "John Doe"; res.end() })
My use case would be when the user logs in, the body of the post is parsed, and the name she logged in with will be saved to the session cookie.
Setting cookies as responses to get requests is not a problem.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Set-Cookie - HTTP - MDN Web Docs
The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent...
Read more >Set-Cookie in Response Header not being created in browser
1 Answer 1 · 1. You need to add the following headers on the server · 2. Be precise about how you set...
Read more >How to send cookies to the server? - ReqBin
Servers store cookies in the client browser by returning "Set-Cookie: name=value" HTTP headers in the response. In this Send Cookies Example ...
Read more >Using cookies - Postman Learning Center
To manage cookies in Postman, open a request, then select Cookies (under Send). ... The Manage Cookies window displays a list of domains...
Read more >About http POST Response.headers set-cookie #362 - GitHub
About http POST Response.headers set-cookie #362. Open. jet10000 opened this issue on Jan 9, 2020 · 5 comments.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi there. I figured it out! I was making the POST with fetch() on the client side, and I needed to add
credentials: 'same-origin'
to the fetch() configuration object. : ) I still do not know why the browser will not render text or html when I respond to a POST request with that, but that’s a topic for a different forum. (You can see the body of the response in the browser dev tools, but for whatever reason, the browser doesn’t render it.) Anyway, thanks for the help!!Hi! Thanks so much for getting that for me! I was thinking of looking into this today, but I think I instead need to focus on https://github.com/expressjs/generator/pull/190#issuecomment-361248460 as it sounds more urgent I think. Once that is done, I’ll come back to this next, but it is unlikely to be today, very sorry 😦