-
-
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
Fixes the issue of stringify encoding comma(used to join array) even when encodeValuesOnly = true
#424
Conversation
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 rebased this on top of my failing tests branch; take a look at the failures. The ???
will need to be updated to an actual expected value.
368880f
to
a360d76
Compare
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.
Overall this looks great!
Are there any additional test cases we should be adding to make sure this is doing both what the issue participants expect, and what we expect?
Thanks! for now these tests seem fine. |
…sOnly = true` Fixes ljharb#410
Codecov Report
@@ Coverage Diff @@
## master #424 +/- ##
=======================================
Coverage 99.78% 99.78%
=======================================
Files 8 8
Lines 1388 1393 +5
Branches 167 169 +2
=======================================
+ Hits 1385 1390 +5
Misses 3 3
Continue to review full report at Codecov.
|
Following changes were made:
encodeValuesOnly = true
, then all characters except the values must not be encoded. This includes brackets and joining characters such as comma. It works perfectly for all other characters except when comma is used to join elements of an array. Then even the comma is encoded.qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'comma' })
to be equal to'a=b,c,d'
. Which is not the expected behavior as for the comma to not be encoded we must either setencode: false
orencodeValuesOnly: true
. So the right result would be'a=b%2Cc%2Cd'
as the default functionality of the function is to encode the complete string.