MCPcopy Create free account
hub / github.com/encode/starlette / test_file_response_known_size

Function test_file_response_known_size

tests/test_responses.py:581–589  ·  view source on GitHub ↗
(tmp_path: Path, test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

579
580
581def test_file_response_known_size(tmp_path: Path, test_client_factory: TestClientFactory) -> None:
582 path = tmp_path / "xyz"
583 content = b"<file content>" * 1000
584 path.write_bytes(content)
585
586 app = FileResponse(path=path, filename="example.png")
587 client: TestClient = test_client_factory(app)
588 response = client.get("/")
589 assert response.headers["content-length"] == str(len(content))
590
591
592def test_streaming_response_unknown_size(

Callers

nothing calls this directly

Calls 3

FileResponseClass · 0.90
test_client_factoryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected