MCPcopy
hub / github.com/fastapi/fastapi / test_head_fallback_request_works

Function test_head_fallback_request_works

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

Source from the content-addressed store, hash-verified

978
979
980def test_head_fallback_request_works(tmp_path: Path):
981 dist = tmp_path / "dist"
982 write_file(dist / "index.html", "app shell")
983 app = FastAPI()
984 app.frontend("/", directory=dist, fallback="index.html")
985
986 response = TestClient(app).head(
987 "/dashboard/settings", headers={"accept": "text/html"}
988 )
989
990 assert response.status_code == 200
991 assert response.text == ""
992 assert response.headers["content-length"] == "9"
993
994
995def test_unsupported_methods_return_405(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…