MCPcopy
hub / github.com/fastapi/fastapi / test_index_fallback_ignores_invalid_q_value

Function test_index_fallback_ignores_invalid_q_value

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

Source from the content-addressed store, hash-verified

62
63
64def test_index_fallback_ignores_invalid_q_value(tmp_path: Path):
65 dist = tmp_path / "dist"
66 write_file(dist / "index.html", "app shell")
67 app = FastAPI()
68 app.frontend("/", directory=dist, fallback="index.html")
69
70 response = TestClient(app).get(
71 "/dashboard/settings", headers={"accept": "text/html; q=wat"}
72 )
73
74 assert response.status_code == 200
75 assert response.text == "app shell"
76
77
78def test_frontend_static_files_lookup_errors(monkeypatch, tmp_path: Path):

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…