mirror of
https://github.com/fastapi/fastapi.git
synced 2026-05-24 16:29:41 -04:00
🔧 Configure strict pytest options and update/refactor tests (#2790)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user