RequestData type hint is dict, possibly should be Union[dict,str,bytes] #2146
Unanswered
arthur-tacca
asked this question in
Potential Issue
Replies: 1 comment
-
|
Agreed! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In
_types.pywe find this line:which affects the type hint in
httpx.Request:That means that forming a request with a string, or sending directly with one of the convenience functions, gives a type hint warning in a decent IDE:
Looking at the implementation of
Request(andPreparedRequest), it appears that using a string like this is valid usage. And it would be a pity, if you've already encoded your JSON for some other reason, to pass the originaldictto httpx just so it can redundantly encode it.If the above is a valid supported usage, I'd say that this is a bug. As the title says,
RequestDataought to beUnion[dict,str,bytes].Beta Was this translation helpful? Give feedback.
All reactions