# error: http: response body too large

- **ID:** `go/http-response-body-leak`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

HTTP 响应体超过预设的最大限制，导致读取失败。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.21 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
   ```
2. **** (85% success)
   ```
   if resp.ContentLength > 1<<20 { log.Println("响应过大") }
   ```

## Dead Ends

- **** — 会导致数据不完整或程序崩溃。 (90% fail)
- **** — 如果恶意响应过大，会消耗大量内存。 (70% fail)
