FastAPI 0.87.0 (and in particular starlette 0.21.0) broke query string parsing in TestClient (starlette 0.22.0 fixes it!) #6199
-
First Check
Commit to Help
Example Codefrom fastapi import FastAPI DescriptionWe have a test that does something like this: now = utc_datetime()
url = client.app.url_path_for("balances")
start_date = now - timedelta(minutes=1)
start_date_param = urlencode({"start_date": start_date.isoformat()})
end_date_param = urlencode({"end_date": now.isoformat()})
response = client.get(url + f"?{start_date_param}&{end_date_param}") With FastAPI 0.86 everything works. Starting from 0.87 (which uses {'error': {'code': 'validation_error', 'message': 'Validation Error', 'errors': [{'attribute': 'query -> start_date', 'code': 'value_error.datetime', 'message': 'invalid datetime format', 'ctx': None}, {'attribute': 'query -> end_date', 'code': 'value_error.datetime', 'message': 'invalid datetime format', 'ctx': None}]}} If I force the installation of
SolutionBump NoteI can make this small PR with the update as soon as you confirm/acknowledge this issue. Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.87.0 Python Version3.10.0 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There's a PR up for this now actually |
Beta Was this translation helpful? Give feedback.
-
The PR is #5659 |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone for the feedback. It seems a duplicate of #5646 yes and since there is already a PR to fix this, I closed the issue already. Looking forward to 0.88.0 release 🫶 |
Beta Was this translation helpful? Give feedback.
Thanks everyone for the feedback. It seems a duplicate of #5646 yes and since there is already a PR to fix this, I closed the issue already. Looking forward to 0.88.0 release 🫶