Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Encoding does not work anymore #9554

Closed
Jakartoine opened this issue Feb 5, 2021 · 11 comments
Closed

URL Encoding does not work anymore #9554

Jakartoine opened this issue Feb 5, 2021 · 11 comments

Comments

@Jakartoine
Copy link

Describe the Issue

With the new version of Postman (8.x), the "URL Encode automatically" has been moved from a global setting to a specific one onto each request in collections (no documentation on it by the way). Even if this setting is activated, URLs are still not encoded and cause a 400 Bad request.

Steps to Reproduce

Create a request.
Open the settings tab on this request and check the "URL Encode automatically" option.
Send your request.
A 400 Bad request is produced.

Screenshots or Videos

image

Environment Information

  • Platform Type: Native Desktop App (MacOS or Windows)
  • Postman Version: 8.0.4
  • Operating System: MacOS 10.15.7
@DannyDainton
Copy link
Contributor

Hey @Jakartoine

Are you able to provide an image of the Console log for the request with it enabled and disabled?

When I run the requests - I see it encoding the URL:

image

The 400 Error code is returned from the server and not really something that's going to happen on any request, as mentioned in the steps. Just trying to get a bit more context for the issue. :D

@kooper100
Copy link

Hi! I'm having a similar issue with encoding '%' in my get parameters now.
If I replace '%' with '%25' manually in the url then it works.

First three queries are with 'Encode URL automatically' enable, next two are with it off, and the last is me manually entering '%25'

example

@Jakartoine
Copy link
Author

Jakartoine commented Feb 5, 2021

Hey @DannyDainton,

You are right, I probably did not give enough information about the issue.

It seems the encoding is working but not as before with this new version.

The value part of a query parameter is not well encoded and you can already notice it in your sample.
Braces should be encoded as before, without that, some APIs are not able to decode it perfectly and it causes
some bad request errors (which is quite specific to the backend side).

@minakshi-goel
Copy link

Hello,
I am having similar issue where I see % characters at the end of URL and so the response is always 404. i guess the characters represent new line. I have "Encode URL automatically" setting enabled. I am on windows 10, postman 8.0.4
I expect postman to ignore/trim those characters and process the request. when you have 100s of requests already running, passed in earlier versions, correcting every single request to delete newline makes no sense with new version.

newline char at he end of url

@VLEESDOEKJE
Copy link

I can confirm that { and } are not encoded.
image

@codenirvana
Copy link
Member

This is a duplicate of #8808.

@Jakartoine {, }, and : are not reserved characters that require automatic encoding, refer #8154 (comment) for more details.

@mccannt
Copy link

mccannt commented Apr 8, 2021

This should be working as expected as per the note above.
Closing this issue. Please reopen if this is an issue for some still, with as much detail as possible.

@mccannt mccannt closed this as completed Apr 8, 2021
@wombat86
Copy link

wombat86 commented Mar 7, 2023

Still relevant for me. The percent symbol is not encoded if it is present in the original parameter value while "Encode URL Automatically" is turned on. It seems that percent sign is simply ignored: when I replace % with %25 in the original value with the auto encoding turned on, it works fine. However, I don't think it's a proper behaviour. Percent sign should be treated as a special character only when "auto encoding" is turned off.

@joggl71xpt
Copy link

ISO Date Time like '2023-05-09T06:40:00+00:00' are also not encoded...

@edpeng
Copy link

edpeng commented Dec 14, 2023

Still relevant for me. The percent symbol is not encoded if it is present in the original parameter value while "Encode URL Automatically" is turned on. It seems that percent sign is simply ignored: when I replace % with %25 in the original value with the auto encoding turned on, it works fine. However, I don't think it's a proper behaviour. Percent sign should be treated as a special character only when "auto encoding" is turned off.

as a workaround add this to the Pre-request Script:

pm.request.url=encodeURI(pm.variables.replaceIn(pm.request.url));

@jason1004
Copy link

ISO Date Time like '2023-05-09T06:40:00+00:00' are also not encoded...

how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests