# http: ContentLength=0 且 Body 长度为 0

- **ID:** `go/http-missing-content-length`
- **领域:** go
- **类别:** protocol_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

服务器期望非零的 ContentLength，但请求体为空，导致协议违规。

## 版本兼容性

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

## 解决方案

1. **** (85% 成功率)
   ```
   Ensure the request body is non-empty or set ContentLength to -1 for chunked encoding.
   ```

## 无效尝试

- **** — This can cause the server to read beyond the body and fail. (50% 失败率)
- **** — This changes the semantics of the request. (60% 失败率)
