hoppscotch: [bug]: query parameters are escaped implicitly
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
When I send a Get
request with the following parameters(in bulk edit).
token: token_part1 token_part2
attrs: password%3Dabc
The actual request sent is url?token=token_part1+token_part2&attrs=password%253Dabc
which is wrong for my server.
If I send the same Get
request using postman, the actual request sent is url?token=token_part1%20token_part2&attrs=password%3Dabc
which is correct for my server.
I found the problem code is around the following code.
url=new URL("http://localhost")
url.searchParams.append('token','token_part1 token_part2')
url.searchParams.append('attrs','password%3Dabc')
console.info(url.toString()) // http://localhost/?token=token_part1+token_part2&attrs=password%253abc
url=new URL('http://localhost/?token=token_part1+token_part2&attrs=password%253abc')
console.info(url.searchParams.get('token')) // token_part1 token_part2
console.info(url.searchParams.get('attrs')) // password%3Dabc
console.info(decodeURI('http://localhost/?token=token_part1+token_part2&attrs=password%253abc')) // http://localhost/?token=token_part1+token_part2&attrs=password%3Dabc
See also https://developer.mozilla.org/en-US/docs/Web/API/URL/toString, https://javascript.info/url, https://url.spec.whatwg.org/#URL-stringification-behavior.
Steps to reproduce
- Go to
Parameters
tab, clickBulk edit
. - Fill with the following contents
token: token_part1 token_part2
attrs: password%3Dabc
- Click
Send
button to make the request.
Environment
Release
Version
Cloud
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 16 (4 by maintainers)
Assigning to @maneeshms.