Encode query parameters regardless of the browser#104
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) // => falseThis 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 <micael.carreira@esab.se>
Problem: Query parameters are not being encoded as expected
value:
this&thatBrowser: Firefox 93.0 (64-bit) Mac OS Big Sur
Google Chrome 94.0.4606.81 (Official Build) (x86_64) (Big Sur)
Solution: Update the
parameterizehelper to always encode the parameters (unless it is already encoded)original issue: #103