insomnia
insomnia copied to clipboard
fix: encoded value be decoded issue
Background
When users pass percent-encoded strings in the query parameters, the encoded characters will be decoded. E.g. %4E.
Root Cause
smartEncodeUrlcallsdeconstructQueryStringToParamsbeforebuildQueryStringFromParams,deconstructQueryStringToParamsalways decodes the params, the original proposal I guess is to keep all the strings to be only encoded once. AlthoughencodeURIComponentanddecodeURIComponentare often thought of as complementary, they are not exact opposites. This is becausedecodeURIComponentwill decode all percent-encoded sequences, whereasencodeURIComponentonly encodes necessary characters.- When there is a
,in the string, it'll be decoded to%2C, which seems it cause issues before, so%2Cwill always be replaced with,. But if there is%2Cin the original input, we should consider it as%2Cinstead of,.
Changes
- Add
skipDecodetodeconstructQueryStringToParams - Use
ignoreparam instead of replace all%2Cto, - Remove unused whitespace replacement
- Fix some typos
Closes #975