diff --git a/httpout/__init__.py b/httpout/__init__.py index 0538051..16b3d44 100644 --- a/httpout/__init__.py +++ b/httpout/__init__.py @@ -1,6 +1,6 @@ # Copyright (c) 2024 nggit -__version__ = '0.0.60' +__version__ = '0.0.61' __all__ = ('HTTPOut',) from .httpout import HTTPOut # noqa: E402 diff --git a/httpout/lib/http_response.py b/httpout/lib/http_response.py index 82fe998..7efe514 100644 --- a/httpout/lib/http_response.py +++ b/httpout/lib/http_response.py @@ -8,6 +8,7 @@ class HTTPResponse: def __init__(self, response): self.response = response self.loop = response.request.protocol.loop + self.logger = response.request.protocol.logger self.tasks = set() def __getattr__(self, name): @@ -87,16 +88,19 @@ def set_content_type(self, content_type='text/html; charset=utf-8'): async def _run_middleware(self): g = self.response.request.protocol.globals + ctx = self.response.request.protocol.context middlewares = g.options['_middlewares']['response'] i = len(middlewares) while i > 0: i -= 1 - if await middlewares[i][1](context=self.response.request.ctx, + if await middlewares[i][1](globals=g, + context=ctx, + loop=self.loop, + logger=self.logger, request=self.response.request, - response=self.response, - loop=self.loop): + response=self.response): break async def write(self, data, **kwargs):