# starlette.formparsers.MultiPartException: multipart 中缺少 boundary。

- **ID:** `python/starlette-missing-boundary-multipart`
- **领域:** python
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

multipart/form-data 请求的 Content-Type 头缺少 boundary 参数，或客户端发送了请求体却没有该头。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   import requests
files = {'file': open('a.png', 'rb')}
requests.post(url, files=files)
   ```
2. **** (92% 成功率)
   ```
   from fastapi import File, UploadFile
@app.post('/upload')
async def upload(file: UploadFile = File(...)):
    ...
   ```

## 无效尝试

- **** — The endpoint expects form fields and fails validation. (80% 失败率)
- **** — Does not fix the client; uploads keep failing. (70% 失败率)
