# error: http: server closed idle connection (client error: EOF)

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

## Root Cause

HTTP响应体未关闭，导致连接无法复用，服务器因空闲超时关闭连接，客户端在读取时遇到EOF。

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   defer resp.Body.Close()
io.Copy(io.Discard, resp.Body) // 确保读取完所有内容
   ```
2. **** (90% success)
   ```
   使用io.ReadAll或json.Decoder时确保正确关闭响应体。
   ```

## Dead Ends

- **** — 不关闭响应体会导致连接泄漏，最终耗尽连接池。 (95% fail)
- **** — 未读取的响应体可能阻止连接复用，导致性能下降。 (70% fail)
