-
-
Notifications
You must be signed in to change notification settings - Fork 858
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
Missing query params in url when params option is set #3433
Comments
This is exactly the behavior I would expect. |
I know providing both params and query in url is a bad practice. But this can be counterintuitive in some situations like: import httpx
client = httpx.Client(params={"foo": "bar"})
request = client.build_request(
"GET", "https://httpbin.org/get?param=default"
)
print(request.url) # This will be `https://httpbin.org/get?foo=bar` The params are provided in the client options. This will also replace the query in the url. May be a warning can be raised when the replaced query is not empty? Line 301 in 15e21e9
|
Related issue...
That is surprising behaviour, yes. I'd consider that a bug. To the extent that we do currently support |
Currently, as a workaround, we merge all the params by ourselves before passing to httpx. The code is clearer logically 😂 . |
…ement (httpx #3433) httpx issue: When passing params={}, always strictly update rather than merge with an existing querystring. PR: encode/httpx#3364 Issue: encode/httpx#3433
…with_filters broke by httpx upgrade test_get_log_entities_with_filters breakage: encode/httpx#3433
Broke quite some of my code, so at least a warning and a hint on how best to merge parameters should be issued. |
In version 0.28.0, query params are never merged.
The query string in the request url will be ignored. It seems this is caused by the pr #3364. Params are replaced instead of merged when parsing.
httpx/httpx/_urlparse.py
Line 301 in 15e21e9
Related discussion #3428
The text was updated successfully, but these errors were encountered: