Skip to content

Error handling in send_file #5394

Closed Answered by davidism
kasium asked this question in Q&A
Jan 26, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Streaming responses can't handle errors late. In WSGI (and I'm pretty sure ASGI too), once a response has started, the headers and status code have already been sent to the client, and the body has already been started. It's impossible to take that back and send something else instead.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kasium
Comment options

Answer selected by kasium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants