diff --git a/tests/test_tutorial/test_middleware/test_tutorial001.py b/tests/test_tutorial/test_middleware/test_tutorial001.py index ec7f7ac3d..548937924 100644 --- a/tests/test_tutorial/test_middleware/test_tutorial001.py +++ b/tests/test_tutorial/test_middleware/test_tutorial001.py @@ -10,3 +10,8 @@ def test_add_process_time_header_middleware(): assert response.json() == {"hello": "world"} assert "X-Process-Time" in response.headers assert len(response.headers["X-Process-Time"]) > 0 + + # request/response process time + process_time = response.headers["X-Process-Time"] + assert float(process_time) > 0 + diff --git a/tests/test_tutorial/test_middleware/test_tutorial002.py b/tests/test_tutorial/test_middleware/test_tutorial002.py index 3eaa8049c..43b2c1121 100644 --- a/tests/test_tutorial/test_middleware/test_tutorial002.py +++ b/tests/test_tutorial/test_middleware/test_tutorial002.py @@ -10,3 +10,6 @@ def test_add_process_time_header_middleware(): assert response.json() == {"hello": "world"} assert "X-Process-Time" in response.headers assert len(response.headers["X-Process-Time"]) > 0 + # request/response process time + process_time = response.headers["X-Process-Time"] + assert float(process_time) > 0