INNER CODE UNIT · Python

__call__

evalstate/fast-agent · src/fast_agent/a2a/server.py:166

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        if scope["type"] != "http":
            await self.app(scope, receive, send)
            return

        path = str(scope.get("path", ""))
        if not path.startswith("/a2a/"):
            await self.app(scope, receive, send)
            return

        headers = list(scope.get("headers", []))
        authorization = _header_value(headers, b"authorization")
        hf_authorization = _header_value(headers, b"x-hf-authorization")
        if authorization is None and hf_authorization is not None:
            authorization = hf_authorization
            headers.append((b"authorization", hf_authorization.encode("latin-1")))
            scope = dict(scope, headers=headers)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…