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

HttpOnly not being set #72

Closed
nickzelei opened this issue Jan 23, 2018 · 6 comments
Closed

HttpOnly not being set #72

nickzelei opened this issue Jan 23, 2018 · 6 comments
Assignees
Labels

Comments

@nickzelei
Copy link

I'm building a cookie that uses HttpOnly, but cookie is not outputting the HttpOnly attribute.

cookie.parse("mytoken=test; Domain=.example.com; Path=/; Expires=Thu, 25 Jan 2018 17:21:33 GMT; HttpOnly")

{ mytoken: 'test',
  Domain: '.example.com',
  Path: '/',
  Expires: 'Thu, 25 Jan 2018 17:21:33 GMT' }
@dougwilson
Copy link
Contributor

The cookie.parse function (https://github.com/jshttp/cookie/blob/master/README.md#cookieparsestr-options) only parses the HTTP "Cookie" header. Your example is the HTTP "Set-Cookie" header.

@dougwilson dougwilson self-assigned this Jan 23, 2018
@nickzelei
Copy link
Author

My bad, thanks for the clarification!

@nitrocode
Copy link

nitrocode commented May 16, 2018

@dougwilson @Zelein I'm confused. If I have httpOnly in my cookie string, how do I get it in the cookie parsed object? Could this be converted to a feature request to have this added?

I'd expect the above example to return:

{ mytoken: 'test',
  Domain: '.example.com',
  Path: '/',
  Expires: 'Thu, 25 Jan 2018 17:21:33 GMT', 
  httpOnly: true }

@nickzelei
Copy link
Author

nickzelei commented May 16, 2018

This module only handles the Cookie Header, not the Set-Cookie Header.

Sorry if this is incorrect, I'm coming into this cold having not looked at this since my previous comment.

@nitrocode
Copy link

nitrocode commented May 16, 2018

@Zelein Thanks.

Perhaps set-cookie-parser would be more up my alley.

@dougwilson
Copy link
Contributor

No, just use a module that parses the set-cookie header. Many already exist. Why add more duplicate modules?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants