MCPcopy
hub / github.com/fastapi/fastapi / test_head_requests_work

Function test_head_requests_work

tests/test_frontend.py:967–977  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

965
966
967def test_head_requests_work(tmp_path: Path):
968 dist = tmp_path / "dist"
969 write_file(dist / "asset.txt", "ok")
970 app = FastAPI()
971 app.frontend("/", directory=dist)
972
973 response = TestClient(app).head("/asset.txt")
974
975 assert response.status_code == 200
976 assert response.text == ""
977 assert response.headers["content-length"] == "2"
978
979
980def test_head_fallback_request_works(tmp_path: Path):

Callers

nothing calls this directly

Calls 4

frontendMethod · 0.95
FastAPIClass · 0.90
write_fileFunction · 0.85
headMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…