Commit 6f9f353
authored
fix: should not throw when fetch a Request with post (#563)
## 现象
使用 post method fetch 一个 Request 对象时会出现 `Cannot construct a Request with
a Request object that has already been used.` 错误。
## 原因
Request 的 constructor 会把入参的 request.body.stream.locked 变为 true,urllib 的
fetch 中已经使用参数 input new 了一个 Request,再调用 undici fetch 时参数还是 input,就会报错。
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Updated the fetch method to utilize a `Request` object for improved
request handling.
- Added a new test case to verify POST request functionality using the
`Request` class.
- **Chores**
- Updated `.gitignore` to exclude the `.idea/` directory.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent bf2b5b1 commit 6f9f353
3 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
112 | 123 | | |
0 commit comments