Skip to content

Conversation

@D-393Patel
Copy link

Previously, in Express 5 environments, req.cookies could remain null when no Cookie header was provided or when an empty Cookie header was sent. This caused unexpected null checks in downstream middleware relying on req.cookies to always be an object. This commit initializes req.cookies to an empty object before early returns, ensuring consistent behavior with Express 4 and maintaining backward compatibility.

Closes: #128

Previously, in Express 5 environments, req.cookies could remain null when no Cookie header was provided or when an empty Cookie header was sent. This caused unexpected null checks in downstream middleware relying on req.cookies to always be an object. This commit initializes req.cookies to an empty object before early returns, ensuring consistent behavior with Express 4 and maintaining backward compatibility. Closes: expressjs#128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

req.cookies is showing null

1 participant