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

Function middleware

tests/test_web_middleware.py:17–22  ·  view source on GitHub ↗
(request, handler: Handler)

Source from the content-addressed store, hash-verified

15
16 @web.middleware
17 async def middleware(request, handler: Handler):
18 resp = await handler(request)
19 assert 200 == resp.status
20 resp.set_status(201)
21 resp.text = resp.text + "[MIDDLEWARE]"
22 return resp
23
24 app = web.Application()
25 app.middlewares.append(middleware)

Callers

nothing calls this directly

Calls 3

set_statusMethod · 0.80
appendMethod · 0.80
handlerFunction · 0.70

Tested by

no test coverage detected