Monday 29 April 2019

Why can't I add a property directly to req.session?

So, I have a POST route that adds properties to req.session like this:req.session.a = a;req.session.b = b;...But then I get this error, "Can't set headers after they are sent."Why is this? If I add something to req.body, it doesn't complain, but if I add something to req.session, I get that error, then I have to delete my cookie and restart the server.

Submitted April 29, 2019 at 09:12PM by Mobile_Monk

No comments:

Post a Comment