-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Use URLSearchParams for cookies #181
base: master
Are you sure you want to change the base?
Conversation
This would insta-break everyone and is too big of a change I think, but you are the maintainer 😄 I actually wanted to ask about this, why not just do this to fix #60: - // only assign once
- if (!__hasOwnProperty.call(obj, key)) {
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
let valEndIdx = endIndex(str, endIdx, valStartIdx);
if (
str.charCodeAt(valStartIdx) === 0x22 /* " */ &&
str.charCodeAt(valEndIdx - 1) === 0x22 /* " */
) {
valStartIdx++;
valEndIdx--;
}
const val = str.slice(valStartIdx, valEndIdx);
obj[key] = tryDecode(val, dec);
- }
We'd have |
I have no preference over keeping last vs first, but I'd be in favor of removing an extra check every iteration (with the possible downside of an extra decode). It seems unordered though, so I don't think that will solve #60. You'd need a way to |
I think this is the relevant piece:
I think you'd want the longest path (most specific) cookie? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
To be as clear as I can be, changes like this are not up to a single maintainer in Express project. They should nearly always be raised to consensus with the @jshttp/express-tc. This is in draft, so it seems likely to me that @blakeembrey did not intend to land this, and just opened it as a proposal. Based on reading this I think my initial response is that we could add a more strict mode for this, and see if we can work toward enabling that by default (maybe with a series of majors with deprecation warnings or something)? But even with that, I would need to think more about it and look into the implications of a change like this first. Which I assume we would do if this PR was taken to the next steps and not intended as a draft. |
Another RFC (cc @gurgunday). This would resolve #60, but is a larger breaking change. There is a perf improvement that kicks in when you have a couple of cookies:
After:
Before: