Replies: 3 comments 1 reply
-
|
Hi, I have noticed a different behaviour from the The URL is sent to me by another service, therefore, there is no chance to separately send the pure URL and query parameters. It would be nice to add this feature. In this line of code, problems appear: Let me copy the script that has been reported in the issue: Here is a simple script: import requests
import httpx
import asyncio
URL = 'https://httpbin.org/get?a=1'
r = requests.get(URL, params={'b': 2})
print('requests', r.json()['args'])
def f():
r = httpx.get(URL, params={'b': 2})
print('httpx', r.json()['args'])
f()Results: requests {'a': '1', 'b': '2'}
httpx {'b': '2'} |
Beta Was this translation helpful? Give feedback.
-
|
Hello @jhominal, Best regards, |
Beta Was this translation helpful? Give feedback.
-
|
I think the previous behavior was also more intuitive. I think this comment is relevant: #3433 (comment) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In light of the resolution of #3433, as I still believe that it is a common need to merge the query string from the URL with a
paramsobject, I propose implementing an option that would allow API users to specify the way that a query string in the URL will interact with aparamsdictionary.url_query_params_mode;replace: that is the behaviour fromhttpx>=0.28 - the query component from the URL is replaced wholesale;merge: that is an approximation of the behaviour ofhttpx<0.28:client.paramsare then merged with the dictionary from the previous step|);request.paramsare then also merged with the dictionary from the previous step;append: that is the behaviour that I personally find the most interesting, basically:client.paramsare serialised to a query string, and appended to the URL;request.paramsare serialised to a query string, and appended to the URL:clientorrequest) will be found in the final URL;What do you think? If anyone at @encode/maintainers thinks that idea is interesting, I would be happy to work on a PR.
Beta Was this translation helpful? Give feedback.
All reactions