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

Method __call__

examples/basic_auth_middleware.py:45–56  ·  view source on GitHub ↗

Add Basic Auth header to the request.

(
        self,
        request: ClientRequest,
        handler: ClientHandlerType,
    )

Source from the content-addressed store, hash-verified

43 return f"Basic {encoded}"
44
45 async def __call__(
46 self,
47 request: ClientRequest,
48 handler: ClientHandlerType,
49 ) -> ClientResponse:
50 """Add Basic Auth header to the request."""
51 # Only add auth if not already present
52 if hdrs.AUTHORIZATION not in request.headers:
53 request.headers[hdrs.AUTHORIZATION] = self._auth_header
54
55 # Proceed with the request
56 return await handler(request)
57
58
59class TestServer:

Callers

nothing calls this directly

Calls 1

handlerFunction · 0.70

Tested by

no test coverage detected