Replies: 1 comment
-
The only viable solution I can think of at the moment is using Related issue: #10857 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
test_serve
used to work fine in v 0.105.0, but gives an exception in 0.106.0:I suspect it has to do with the breaking change in 0.106.0 and would like to get a suggestion what is the idiomatic way of serving a temporary file.
The technique I used is also suggested in this SO discussion: https://stackoverflow.com/a/72535413/18775, but it seems this way is broken now.
There is a discussion here #8633 where a StreamingResponse is used--in my example
test-no-inject
endpoint works fine andtest_serve_no_inject
demonstrates it, however it is prone to an file descriptor leak in case response is broken halfway.And here #2152 a background task is used to delete a temporary file.
I am in search for an idiomatic way, which is going to decrease the chances I have to rework this bit again.
Operating System
macOS
Operating System Details
I also tried it on Linux
FastAPI Version
0.106.0
Pydantic Version
1.10.13
Python Version
Python 3.10.13
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions