Coverage for docs_src / custom_response / tutorial008_py310.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from fastapi import FastAPI 1abcd
2from fastapi.responses import StreamingResponse 1abcd
4some_file_path = "large-video-file.mp4" 1abcd
5app = FastAPI() 1abcd
8@app.get("/") 1abcd
9def main(): 1abcd
10 def iterfile(): # (1) 1efg
11 with open(some_file_path, mode="rb") as file_like: # (2) 1efg
12 yield from file_like # (3) 1efg
14 return StreamingResponse(iterfile(), media_type="video/mp4") 1efg