-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
qs.parse omitting empty string keys #432
Comments
Please link me if I'm wrong, but I don't believe the spec permits empty keys in a query string. What's your use case/software where that's expected? |
Thanks for the fast reply, I was using this as a reference: new URLSearchParams('=1').getAll('') // ['1'] Our use case is that we need to evaluate user input in HTTP client editor, in some cases key might be not present yet or really evaluates to empty string. As a workaround I am assigning empty key names to temporal key and after parsing replacing them back :D This also requires preserving initial keys order, so hack becomes quite complex.. I can also imagine that some server/api might use this empty param name, even if it is not part of any RFC |
"USP supports it" is a good argument, although your use cases are not convincing - if the key's not present yet, then the value isn't either, and I'm not clear on why the key would really evaluate to an empty string. The PR adding this would have to add it to both parse and stringify, so that there could be a round trip. Additionally, what happens with |
Great! i will open a pr then soon and we can continue there 🙏 |
To be clear: a PR will need:
|
Hi, it will be nice to have this part configurable:
qs/lib/parse.js
Lines 150 to 152 in 542a5c7
current output:
expected output :
If you are ok - I can open a PR
The text was updated successfully, but these errors were encountered: