Question for RequestData type #2395
-
In
which affects the type hint in
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 (and PreparedRequest), 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 original dict to 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, RequestData ought to be Union[dict,str,bytes]. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
That's a deprecated usage, and should be showing you a warning. https://github.com/encode/httpx/blob/master/httpx/_content.py#L201-L206 Use |
Beta Was this translation helpful? Give feedback.
-
It should show a warning to you. |
Beta Was this translation helpful? Give feedback.
It should show a warning to you.