On Aug 6, 2014, at 9:55 AM, Neil Camara <[email protected]> wrote:
> The problem is the "redirect" is not working and I'm getting this message:
>
> Error: Can't set headers after they are sent.
[snip]
> Here is the code
[snip]
> res.cookie('credentials', userData).send();
> res.redirect('http://localhost:3000/reloaded');
Both 'send' and 'redirect' send the response; you only get to do that once. If
you remove the send, the redirect will do it and it will work as you expect.
The cookies will still be sent -- they're queued up as headers, ready to send
before the body starts being sent (or in this case, skipped, since redirects
have no body)
Aria
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/59E0F8C5-85B1-4178-9635-05955A217F76%40nbtsc.org.
For more options, visit https://groups.google.com/d/optout.