You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i have form encoded data with None, by using requests the data is not sent to the server. But this is different for aiohttp, is sent "None" string. This happen also in httpx, take a look at this issue encode/httpx#1500. Is this really the expected behavior?
This seems like an antipattern to me and I'd be more inclined to raise a TypeError. I don't have a strong opinion though, so if other maintainers think it's a good idea then I'm fine with it.
I would note there is a lack of type annotations here though, so those should probably be fixed regardless (ClientSession._request(data=) and FormData.__init__(fields=)).
Yes, exactly. If you don't want a parameter output, then don't pass a parameter at all. Passing None I would currently describe as undefined behaviour, as it's not an expected value.
I would like to know if this behavior is documented and is it already included in test? If not, i suggest provide the documentation and add the test for this behavior, so the expected behavior is defined, which result as None string.
Is that the expected behaviour though? As far as I can tell the method expects string values. Any other type should either raise a TypeError or, to save some performance, have undefined behaviour.
Describe the bug
When i have form encoded data with
None
, by using requests the data is not sent to the server. But this is different for aiohttp, is sent"None"
string. This happen also in httpx, take a look at this issue encode/httpx#1500. Is this really the expected behavior?To Reproduce
Code
Output
Take a look at the
form
, its contain None'form': {'foo': 'None'}
.Expected behavior
Code
Output
Take a look at the
form
, its empty'form': {}
.Logs/tracebacks
Python Version
Python 3.12.1
aiohttp Version
multidict Version
yarl Version
OS
Windows 10
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: