# 错误：http：在已关闭的响应体上读取

- **ID:** `go/net-http-response-body-not-closed`
- **领域:** go
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

从已关闭的HTTP响应体中读取，通常由于过早关闭或重复关闭。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## 解决方案

1. **Always defer close after checking error** (95% 成功率)
   ```
   resp, err := http.Get(url)
if err != nil { return err }
defer resp.Body.Close()
// read resp.Body
   ```

## 无效尝试

- **Not closing response body at all** — Leads to resource leak and eventually connection pool exhaustion. (80% 失败率)
