Skip to content

Commit

Permalink
Skip middleware on RequestCancelled (#2720)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopkins committed Mar 20, 2023
1 parent 53820bc commit ac1f561
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sanic/http/http1.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ async def error_response(self, exception: Exception) -> None:
if self.request is None:
self.create_empty_request()

request_middleware = not isinstance(exception, ServiceUnavailable)
request_middleware = not isinstance(
exception, (ServiceUnavailable, RequestCancelled)
)
try:
await app.handle_exception(
self.request, exception, request_middleware
Expand Down

0 comments on commit ac1f561

Please sign in to comment.