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

Use percent encoding for spaces in query parameters #2536

Closed
1 task done
chbndrhnns opened this issue Jan 3, 2023 · 0 comments · Fixed by #2543
Closed
1 task done

Use percent encoding for spaces in query parameters #2536

chbndrhnns opened this issue Jan 3, 2023 · 0 comments · Fixed by #2543
Labels
user-experience Ensuring that users have a good experience using the library

Comments

@chbndrhnns
Copy link

httpx currently encodes spaces in the query parameter using the + sign:

>>> httpx.URL("https://www.example.com", params={"a": "b c"})
URL('https://www.example.com?a=b+c')

This causes problems for me described in the linked discussion. Tom's comment:

However using https://www.example.com/?a=b c in the address bar in various browsers...

Chrome, Safari, and Firefox all switch this out to https://www.example.com/?a=b%20c.
(Firefox displays "https://www.example.com/?a=b c" but I can see from the "page info" the actual URL it requested.)

So... we could probably switch to %20, and it might be a marginally better choice. (?)


@tomchristie tomchristie added the user-experience Ensuring that users have a good experience using the library label Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-experience Ensuring that users have a good experience using the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants