From 11c841ab4e9ced6b75d1db67f4d4b6ff75f91fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=2E=20K=C3=A4rkk=C3=A4inen?= Date: Wed, 20 Sep 2023 19:58:44 +0100 Subject: [PATCH] Add test for issue #2823 --- tests/test_response.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_response.py b/tests/test_response.py index db3036ea..6c937fcb 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -178,6 +178,10 @@ def json_app(app): async def unmodified_handler(request: Request): return json(JSON_DATA, status=304) + @app.get("/precondition") + async def precondition_handler(request: Request): + return json(JSON_DATA, status=412) + @app.delete("/") async def delete_handler(request: Request): return json(None, status=204) @@ -193,6 +197,10 @@ def test_json_response(json_app): assert response.text == json_dumps(JSON_DATA) assert response.json == JSON_DATA + request, response = json_app.test_client.get("/precondition") + assert response.status == 412 + assert response.json == JSON_DATA + def test_no_content(json_app): request, response = json_app.test_client.get("/no-content")