-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixed] Double-encoding of query strings
Also, don't use indices in array query string values. Fixes #721
- Loading branch information
Showing
2 changed files
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fe5ec39
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.
Don't some (rails) servers want
c[]=d&c[]=e
? Can we make this work withqs
?fe5ec39
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.
@rpflorence hmm, googled around a bit and yes, it looks like PHP and Rails won't like
c=d&c=e
. Butqs
only supports indexed args, e.g.c[0]=d&c[1]=e
which we don't want either. We probably need to submit a PR upstream on qs to fix this.fe5ec39
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.
the only time this matters is when you want to just pass along your client-side query to a server-side query (like an autocomplete component). You have a chance to build your own with the query object the router gives you, so its not an insurmountable task, but yeah, an upstream option would be great.
fe5ec39
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.
looks like they're moving towards a solution that will give consistent parsing and generation of array params: ljharb/qs#46 /cc @amireh
fe5ec39
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.
... specifically the comments at the end re arrayFormat ... now to create a PR :)
fe5ec39
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.
@jenseng done! ljharb/qs#70
fe5ec39
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.
awesome, thx @mjackson!