You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assigning an empty object to req.session does not clear an existing session #225
When a request carries a valid session cookie and the handler assigns req.session = {}, the response has no Set-Cookie header. The browser keeps the old cookie, so the next request still sees the previous session data.
Request /reset with those cookies. The response has no Set-Cookie header.
Request / with the same cookies. The response is {"user":"alice"}.
Expected behavior
The session is replaced with an empty session, the same as when every key is deleted from an existing session (delete req.session.user), which writes an empty session cookie.
Cause
req.session = {} creates a new session. On onHeaders, a new session is saved only when it is populated, so the empty replacement is never written and the request cookie stays in place.
Activity