Browse Source

test: cover head helper without methods

pull/15356/head
Herrtian 2 months ago
parent
commit
bd5b735914
  1. 10
      tests/test_auto_head_for_get.py

10
tests/test_auto_head_for_get.py

@ -139,6 +139,16 @@ def test_head_not_added_to_non_get_routes():
assert client.head("/items/1").status_code == 405
def test_head_not_added_when_route_has_no_methods():
def read_items():
return []
route = APIRoute("/items", read_items)
route.methods = set()
assert route._is_head_for_get({"type": "http", "method": "HEAD"}) is False
def test_explicit_head_route_in_schema():
"""When HEAD is explicitly declared, it SHOULD appear in OpenAPI."""
app = FastAPI()

Loading…
Cancel
Save