We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
we should check input value types. Current behavoir which simply convert input value to str(v) is not very ideal.
str(v)
for example:
import httpx r = httpx.post( "https://httpbin.org/post", data={ "content": bytes.fromhex( "4f5f13d16da9f10d013933673a1ef4e7b974dbe3" ), # random non-printable bytes }, ) print(r.json()["form"])
will get {'content': "b'O_\\x13\\xd1m\\xa9\\xf1\\r\\x0193g:\\x1e\\xf4\\xe7\\xb9t\\xdb\\xe3'"}
{'content': "b'O_\\x13\\xd1m\\xa9\\xf1\\r\\x0193g:\\x1e\\xf4\\xe7\\xb9t\\xdb\\xe3'"}
add type checking and more coerce.
int
float
bool
None
Enum
TypeError
not sure how to handle this....
This will cause breaking changes, so we should consider do a minor version bump.
related: #1500 #1539 #1608
httpx/httpx/_content.py
Lines 136 to 149 in 4b85e6c
httpx/httpx/_utils.py
Lines 56 to 68 in 4b85e6c
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Problem
we should check input value types. Current behavoir which simply convert input value to
str(v)
is not very ideal.for example:
will get
{'content': "b'O_\\x13\\xd1m\\xa9\\xf1\\r\\x0193g:\\x1e\\xf4\\xe7\\xb9t\\xdb\\xe3'"}
Proposal
add type checking and more coerce.
for example:
form/query
int
/float
to str withstr(v)
bool
(Represent as JSON-style "true"/"false")None
(Represent as empty string)Enum
(Use .value and then as above.)TypeError
for anything else.multipart_data
not sure how to handle this....
This will cause breaking changes, so we should consider do a minor version bump.
related: #1500 #1539 #1608
httpx/httpx/_content.py
Lines 136 to 149 in 4b85e6c
httpx/httpx/_utils.py
Lines 56 to 68 in 4b85e6c
The text was updated successfully, but these errors were encountered: