If params=...
is passed then replace any existing query parameters, rather than merge them.
#2743
Replies: 6 comments
-
How about giving a keyword and decide replace or merge, likes |
Beta Was this translation helpful? Give feedback.
-
Hrrmmm... We can do this being explicit: url = httpx.URL('http://example.com?a=1').copy_with(params=...) # Replaces params
url = httpx.URL('http://example.com?a=1').copy_merge_params(...) # Merges params
r = httx.Request('GET', url) |
Beta Was this translation helpful? Give feedback.
-
would this include replacing query params that were passed in the |
Beta Was this translation helpful? Give feedback.
-
Hm, I think I'd expect merge with the ability to "remove" parameters with |
Beta Was this translation helpful? Give feedback.
-
@tomchristie - I'm nudging this issue into a discussion. If we reach a design consensus then we can escalate it into an issue. |
Beta Was this translation helpful? Give feedback.
-
They have now very clear semantics, same as cookies (more or less) and headers: they're common values, used by all requests. Would having a sub-clients that share the connection pool be a solution? Something kinda like
Slippery road of having separate semantics for |
Beta Was this translation helpful? Give feedback.
-
Prompted by #2712 (comment).
Currently when the URL contains existing query parameters and the
params=...
argument is passed, we merge the sets of query parameters...This seems a bit counter-intuitive to me - I'd probably(?) expect them to be replaced, rather than merged.
Is it worth us changing this behaviour?
Implemented here...
httpx/httpx/_models.py
Line 330 in a682f6f
Beta Was this translation helpful? Give feedback.
All reactions