Skip to content

Commit

Permalink
release 0.0.61 (#53)
Browse files Browse the repository at this point in the history
* fix context

---------

Co-authored-by: nggit <[email protected]>
  • Loading branch information
nggit and nggit authored Nov 26, 2024
1 parent f3bca00 commit d484cdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion httpout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2024 nggit

__version__ = '0.0.60'
__version__ = '0.0.61'
__all__ = ('HTTPOut',)

from .httpout import HTTPOut # noqa: E402
10 changes: 7 additions & 3 deletions httpout/lib/http_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit d484cdb

Please sign in to comment.