Skip to content

Commit 46974c5

Browse files
authored
⬆ Bump Starlette to version 0.22.0 to fix bad encoding for query parameters in TestClient (fastapi#5659)
closes fastapi#5646
1 parent 89ec1f2 commit 46974c5

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ classifiers = [
3939
"Topic :: Internet :: WWW/HTTP",
4040
]
4141
dependencies = [
42-
"starlette==0.21.0",
42+
"starlette==0.22.0",
4343
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
4444
]
4545
dynamic = ["version"]

tests/test_starlette_urlconvertors.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from fastapi import FastAPI, Path
1+
from fastapi import FastAPI, Path, Query
22
from fastapi.testclient import TestClient
33

44
app = FastAPI()
@@ -19,6 +19,11 @@ def path_convertor(param: str = Path()):
1919
return {"path": param}
2020

2121

22+
@app.get("/query/")
23+
def query_convertor(param: str = Query()):
24+
return {"query": param}
25+
26+
2227
client = TestClient(app)
2328

2429

@@ -45,6 +50,13 @@ def test_route_converters_path():
4550
assert response.json() == {"path": "some/example"}
4651

4752

53+
def test_route_converters_query():
54+
# Test query conversion
55+
response = client.get("/query", params={"param": "Qué tal!"})
56+
assert response.status_code == 200, response.text
57+
assert response.json() == {"query": "Qué tal!"}
58+
59+
4860
def test_url_path_for_path_convertor():
4961
assert (
5062
app.url_path_for("path_convertor", param="some/example") == "/path/some/example"

0 commit comments

Comments
 (0)