-
Notifications
You must be signed in to change notification settings - Fork 68
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
Encode query parameters regardless of the browser #104
base: master
Are you sure you want to change the base?
Conversation
I have this same issue and would love to see this PR land. However, I wonder if the test of MDN gives this method for determining if a string contains encoded components.
We may also want to add a
|
Yeah I agree using value = "http://example.com/api/v1/people?filter[name]=%22Jane%22"
decodeURIComponent(value) // => "http://example.com/api/v1/people?filter[name]=\"Jane\""
decodeURL(value) // => "http://example.com/api/v1/people?filter[name]=\"Jane\""
decodeURI(value) !== decodeURIComponent(value) // => false This would result in a double encoding. But we can use value = "http://example.com/api/v1/people?filter[name]=%22Jane%22"
decodeURI(value) === value // => false |
@phyllipy I suspect you don't want to have commited |
Solution was taken from existing PR in original spraypaint repository: graphiti-api#104
* Creates test for filtering with spectial characters * Fixes encoding of special characters. Solution was taken from existing PR in original spraypaint repository: graphiti-api#104 Co-authored-by: Micael Carreira <[email protected]>
Problem: Query parameters are not being encoded as expected
value:
this&that
Browser: Firefox 93.0 (64-bit) Mac OS Big Sur
Google Chrome 94.0.4606.81 (Official Build) (x86_64) (Big Sur)
Solution: Update the
parameterize
helper to always encode the parameters (unless it is already encoded)original issue: #103