Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Oct 14, 2024
1 parent 103405a commit 1faa86c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asab/web/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..tls import SSLContextBuilder
from .service import WebService
from ..application import Application
from ...contextvars import Request

#

Expand Down Expand Up @@ -137,15 +138,14 @@ def __init__(self, websvc: WebService, config_section_name: str, config: typing.
self.add_preflight_handlers(preflight_paths)

@aiohttp.web.middleware
async def request_context_middleware(request, handler):
from ...contextvars import Request
async def store_request_in_context(request, handler):
request_ctx = Request.set(request)
try:
return await handler(request)
finally:
Request.reset(request_ctx)

self.WebApp.middlewares.append(request_context_middleware)
self.WebApp.middlewares.append(store_request_in_context)


async def _start(self, app: Application):
Expand Down

0 comments on commit 1faa86c

Please sign in to comment.