postman-code-generators
postman-code-generators copied to clipboard
Wrong URL Encode
Describe the bug There seems to be a bug in URL encode for PHP generator (cURL, HTTP_Request2, pecl_http) and many others languages
To Reproduce fix the URL encode
Expected code snippet and corresponding request
resource_id=sc-domain%253Aexample.com
is wrong encoing
the right one is resource_id=sc-domain%3Aexample.com
Screenshots
Additional context the two URLs are different so the whole request would give two separate results.
Version of postman-code-generators/Postman app: I have the latest version for windows v7.36.1
The issue is that it is not replacing '%' sign correctly when it is passed as params in the Request body.
To Reproduce:
Pass a parameter with '%' as value to any key
The error:
Error is at line 111 of postman-code-generators/codegens/php-curl/lib/php-curl.js/
The encodeURI() function parses '%' as '%25'
I would like to work on this issue. @abhijitkane
Well I know what's the problem is, there is double encoding in there which cause the % to be encoded in the second time. I just mentioned it to be solved in the next update. Thanks for your work and if It's necessary I can help you guys :)
@Farhan25 Can you share the exact url that you are passing to postman? The one without any encoding applied.
@webholik In that case, one cannot just copy any URL (say from chrome's URL bar), and paste it in Postman's URL Field.
I have made a PR #437 that fixes this issue. Can you please review it? Thanks
@ShauryaAg of course, here is a similar one: https://search.google.com/search-console/links?resource_id=sc-domain%3Aexample.com
the problem is encoding the percentage symbol in the second time (% is encoded as %25).
: => %3A %3A => %253A