-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
fix(docs): add disclaimer about parsing set-cookie #213
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,6 +26,8 @@ Parse a HTTP `Cookie` header string and returning an object of all cookie name-v | |||||||||
The `str` argument is the string representing a `Cookie` header value and `options` is an | ||||||||||
optional object containing additional parsing options. | ||||||||||
|
||||||||||
**NOTE:** This method does not parse the `set-cookie` header. It parses the `cookie` header. This means you cannot do `cookie.parse(cookie.serialize('name', 'value'))`. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example can be improved, as that code works fine. serialize w/ no options essentially makes a valid I think we should give folks a little more info so they understand the failure state and risk. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
```js | ||||||||||
const cookies = cookie.parse("foo=bar; equation=E%3Dmc%5E2"); | ||||||||||
// { foo: 'bar', equation: 'E=mc^2' } | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already says it parses the
Cookie
header twice in the above paragraph, would prefer to keep the note shorter so someone skimming actually reads it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmao I went in the opposite direction with my suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd split the difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am personally in favor of a more detailed description. Honestly I would prefer to talk about the difference and even show a detailed example (on top of what your suggestion is below). The larger we make the block warning for this the more likely someone is to see it IMO. Replying here since this is the one with the discussion, but I lean toward @jonchurch's direction below.