From 718919b24dfb031dc3d1a88139481b47039c2756 Mon Sep 17 00:00:00 2001 From: marius-mather Date: Wed, 13 Sep 2023 16:35:46 +1000 Subject: [PATCH 1/2] Add list query to main router --- tests/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/main.py b/tests/main.py index 20a9cdb4c..f592d3297 100644 --- a/tests/main.py +++ b/tests/main.py @@ -208,6 +208,11 @@ def get_query_type_optional_10(request, query: int = 10): return f"foo bar {query}" +@router.get("/query/list") +def get_query_list(request, query: list[str] = Query(...)): + return ",".join(query) + + @router.get("/query/param") def get_query_param(request, query=Query(None)): if query is None: From 44bcf1fefc168e399d3c31e83647be9bd3b22cb3 Mon Sep 17 00:00:00 2001 From: marius-mather Date: Wed, 13 Sep 2023 16:35:56 +1000 Subject: [PATCH 2/2] Test list passing --- tests/test_query.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_query.py b/tests/test_query.py index 969c4f312..8d0c3f535 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -57,6 +57,7 @@ ("/query/int/default", 200, "foo bar 10"), ("/query/int/default?query=50", 200, "foo bar 50"), ("/query/int/default?query=foo", 422, response_not_valid_int), + ("/query/list?query=a&query=b&query=c", 200, "a,b,c"), ("/query/param", 200, "foo bar"), ("/query/param?query=50", 200, "foo bar 50"), ("/query/param-required", 422, response_missing),