-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
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
Bad encoding in query parameters with new TestClient using httpx.Client #5646
Comments
I just saw this it is not related to FastAPI but to Starlette 😅, after encode/starlette#1376, and the example code above fails the same way if using the original object I'll try to ask there 👍 Not sure if closing this one, as |
For those in a hurry, or just to quick-check that the strange broken tests you're having after the
will swap the published version with a fixed one containing encode/starlette#1953 👍 |
This is solved in Starlette 0.22.0. |
@Kludex What is the plan to fix it in FastAPI? Is there a PR that pulls in the Starlette 0.22.0? The Starlette 0.22.0 is already out. |
@azogue Nice, even with a test! |
Thanks @azogue for reporting and upgrading it here! 🍰 Thanks everyone for the discussion too! ☕ This is available in FastAPI |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
After the change to
httpx
for theTestClient
in v0.87.0, the query parameters are not properly encoded? when sending requests with it, and strings are corrupted when received in the endpoints.The example app works as expected if called from the SwaggerUI or from another python process using a plain
httpx.Client
, so it appears something broke with the new wrapping forTestClient
🥲Operating System
macOS
Operating System Details
M1, running arm64 arch
FastAPI Version
0.87.0
Python Version
Python 3.10.5
Additional Context
starlette-0.21
httpx-0.23.0
Discovered when trying to migrate the test suite for a ~big project previously using fastapi-0.85.1 + starlette-0.20.4.
All minor syntax changes from old
requests
to newhttpx
were under control, but in one unit test, a string with an accent was making some search to fail without results (test is sending "Formalización" but endpoint is receiving "Formalización" 😱), and I was getting crazy 😅The text was updated successfully, but these errors were encountered: