Skip to content

Commit

Permalink
Dispatch http.lifecyle.response from exception handler (#2299)
Browse files Browse the repository at this point in the history
  • Loading branch information
whos4n3 committed Nov 19, 2021
1 parent 9c576c7 commit 722a6db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sanic/app.py
Expand Up @@ -775,6 +775,14 @@ async def handle_exception(
if request.stream:
response = request.stream.response
if isinstance(response, BaseHTTPResponse):
await self.dispatch(
"http.lifecycle.response",
inline=True,
context={
"request": request,
"response": response,
},
)
await response.send(end_stream=True)
else:
raise ServerError(
Expand Down

0 comments on commit 722a6db

Please sign in to comment.