diff --git a/potassium/potassium.py b/potassium/potassium.py index b4952cd..2cce945 100644 --- a/potassium/potassium.py +++ b/potassium/potassium.py @@ -158,6 +158,7 @@ def _handle_generic(self, endpoint, flask_request): res = make_response() res.status_code = 400 res.headers['X-Endpoint-Type'] = endpoint.type + self._gpu_lock.release() return res if endpoint.type == "handler": diff --git a/tests/test_endpoints.py b/tests/test_endpoints.py index 6e621a6..d3f2fd6 100644 --- a/tests/test_endpoints.py +++ b/tests/test_endpoints.py @@ -47,6 +47,14 @@ def handler2_id(context: dict, request: potassium.Request) -> potassium.Response assert res.status_code == 200 assert res.json == {"hello": "some_path/child_path"} + res = client.post("/", data='{"key": unquoted_value}', content_type='application/json') + assert res.status_code == 400 + # check status + res = client.get("/__status__") + assert res.status_code == 200 + assert res.json is not None + assert res.json["gpu_available"] == True + # parameterized test for path collisions @pytest.mark.parametrize("paths", [ ("/", "",),