Merge pull request #216 from cr0hn/patch-2
Apply response Middleware always
This commit is contained in:
commit
8e19b5938c
|
@ -193,18 +193,18 @@ class Sanic:
|
||||||
if isawaitable(response):
|
if isawaitable(response):
|
||||||
response = await response
|
response = await response
|
||||||
|
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
# Response Middleware
|
# Response Middleware
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
|
|
||||||
if self.response_middleware:
|
if self.response_middleware:
|
||||||
for middleware in self.response_middleware:
|
for middleware in self.response_middleware:
|
||||||
_response = middleware(request, response)
|
_response = middleware(request, response)
|
||||||
if isawaitable(_response):
|
if isawaitable(_response):
|
||||||
_response = await _response
|
_response = await _response
|
||||||
if _response:
|
if _response:
|
||||||
response = _response
|
response = _response
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
|
|
Loading…
Reference in New Issue
Block a user