MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / middleware

Function middleware

tests/test_web_exceptions.py:244–249  ·  view source on GitHub ↗
(request, handler)

Source from the content-addressed store, hash-verified

242async def test_HTTPException_retains_cookie(aiohttp_client: AiohttpClient) -> None:
243 @web.middleware
244 async def middleware(request, handler):
245 try:
246 return await handler(request)
247 except web.HTTPException as exc:
248 exc.set_cookie("foo", request["foo"])
249 raise exc
250
251 async def save(request):
252 request["foo"] = "works"

Callers

nothing calls this directly

Calls 2

set_cookieMethod · 0.80
handlerFunction · 0.70

Tested by

no test coverage detected