# 类型错误：__call__() 接受 1 个位置参数，但给出了 2 个

- **ID:** `python/starlette-middleware-error`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

中间件类未正确实现 __call__ 方法。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   class MyMiddleware:\n    def __init__(self, app):\n        self.app = app\n    async def __call__(self, scope, receive, send):\n        await self.app(scope, receive, send)
   ```
2. **** (85% 成功率)
   ```
   async def simple_middleware(request, call_next):\n    response = await call_next(request)\n    return response
   ```

## 无效尝试

- **** — 签名不匹配。 (70% 失败率)
- **** — 导致中间件无法工作。 (90% 失败率)
