🔧 Configure strict pytest options and update/refactor tests (#2790)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Thomas GraingerandSebastián Ramírez authored and GitHub committed 2021-07-19 21:14:58 +02:00
1 parent 71c96d9eb9
commit 2d296c5d07
9 files changed
+147 -129

No files matched your search

+5 -2
View File
@@ -7,5 +7,8 @@ app = FastAPI()
@app.get("/")
def main():
file_like = open(some_file_path, mode="rb")
return StreamingResponse(file_like, media_type="video/mp4")
def iterfile(): # (1)
with open(some_file_path, mode="rb") as file_like: # (2)
yield from file_like # (3)
return StreamingResponse(iterfile(), media_type="video/mp4")