Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookie-parser populates req.cookies (plural) #18

Closed
gpbmike opened this issue Feb 19, 2016 · 0 comments
Closed

cookie-parser populates req.cookies (plural) #18

gpbmike opened this issue Feb 19, 2016 · 0 comments

Comments

@gpbmike
Copy link

gpbmike commented Feb 19, 2016

cookie-parser populates req.cookies (plural) and plugToRequest incorrectly checks req.cookie (singular).

Parse Cookie header and populate req.cookies with an object keyed by the cookie names.

https://github.com/expressjs/cookie-parser

function plugToRequest(req, res) {
  if (req.cookie) {
    _rawCookie = req.cookie;
  } else if (req.headers && req.headers.cookie) {
    setRawCookie(req.headers.cookie);
  } else {
    _rawCookie = {};
  }

  _res = res;
}

https://github.com/eXon/react-cookie/blob/master/index.js#L67-L77

Not really breaking since req.headers.cookie is a fallback and that exists but I thought I would point it out.

pjvds referenced this issue in pjvds/react-cookie May 10, 2016
pjvds referenced this issue in pjvds/react-cookie May 10, 2016
@eXon eXon closed this as completed in 803d178 May 18, 2016
eXon added a commit that referenced this issue May 18, 2016
Fix #18 cookie-parser populates req.cookies (plural)
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

No branches or pull requests

1 participant