Dispatch http.lifecyle.response from exception handler (#2299)
This commit is contained in:
parent
9c576c74db
commit
722a6db8d9
@ -775,6 +775,14 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
|
|||||||
if request.stream:
|
if request.stream:
|
||||||
response = request.stream.response
|
response = request.stream.response
|
||||||
if isinstance(response, BaseHTTPResponse):
|
if isinstance(response, BaseHTTPResponse):
|
||||||
|
await self.dispatch(
|
||||||
|
"http.lifecycle.response",
|
||||||
|
inline=True,
|
||||||
|
context={
|
||||||
|
"request": request,
|
||||||
|
"response": response,
|
||||||
|
},
|
||||||
|
)
|
||||||
await response.send(end_stream=True)
|
await response.send(end_stream=True)
|
||||||
else:
|
else:
|
||||||
raise ServerError(
|
raise ServerError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user