-
-
Notifications
You must be signed in to change notification settings - Fork 845
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 /
in query params, for better robustness.
#2721
Comments
Let me nudge you in the right direction here... Line 264 in 7335950
Also we don't want to make it optional, we just want to change the behaviour. Evidently percent-encoding |
/
in query params, for better robustness.
@tomchristie just so you know: this broke more than the Twitter API. I have a project in which I want to request a signed URL to an image (from the OpenAI API) using httpx. Some signature query params contain forward slashes, and the server evidently doesn't accept it if those are encoded as I want to note that the URL works in Firefox, Chrome, and using It might be true that encoding the slashes is technically "more correct", but that doesn't really help if the server just won't accept it. |
Yeah, hit this as well in #2883 when migrating from requests to httpx, unconditionally precent-encoding |
Jumping in to signal we also had to revert httpx from 0.25.0 to 0.24.1 due to this PR. |
Discussed in #2661
Originally posted by marban April 15, 2023
Haven't gotten into the details but by upgrading to 0.24 and using a regular dict as GET params that contains e.g. an url like {"q": "http://example.com"} will somehow break the request to, in this case, Twitter's API. If if urllib.parse.quote_plus the "http://example.com", everything works fine (The slash is the culprit).
If I urlencode the whole dict manually before passing it to httpx and call the r.url after the request the / is again not encoded, although it previously was.
https://api.twitter.com/1.1/search/tweets.json?q=url%3Ahttp%3A//google.com
I assume it has to do with
The text was updated successfully, but these errors were encountered: