Closed palli closed 8 years ago
@palli
Should line 75 be:
paramString = (paramString || '').replace(/\+/g, ' ')
instead of
paramString = (paramString || '').replace(/\+/g, '%20')
@cherukumilli both will work, but having %20 is more correct because the string is still supposed to be encoded until decodeUriComponent has been called.
Ping (the friendly kind) ?
Another Ping.
Looks good, just one comment. Sorry for the delay, I initially thought this was caught up in the #36 mess, but it looks unrelated, as it's in the query param encoder.
LGTM, thanks for the contribution!
Thanks! Can this be cherry picked into a new version ?
Internally uses decodeUriComponent to decode query string into a javascript object. Turns out upon investigation that decodeUriComponent does not handle all forms of valid encodings, only the ones produced by encodeUriComponent.
Encoding a space into + instead of %20 is relatively common (in query string only, not full urls) and perfectly valid according to https://en.wikipedia.org/wiki/Query_string#URL_encoding
This patch adds a special case around decodeUriComponent so it also handles + in the query string.
Fixes #45.