# RuntimeError: The request body is already consumed

- **ID:** `python/starlette-request-stream-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Starlette 请求体流被多次读取或消费

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |
| 3.11 | active | — | — |

## Workarounds

1. **一次性消费请求体并缓存** (95% success)
   ```
   body = await request.body()
# 后续使用 body 而非再次读取流
   ```
2. **使用中间件缓存请求体** (90% success)
   ```
   @app.middleware('http')
async def cache_body(request, call_next):
    if request.method in ['POST', 'PUT']:
        body = await request.body()
        request.state.body = body
    return await call_next(request)
   ```

## Dead Ends

- **重新读取已消费的流** — 流不可重置 (90% fail)
- **复制请求体到内存** — 可能消耗大量内存 (60% fail)
