Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
fetch
提交
7d92dff1
F
fetch
项目概览
github
/
fetch
8 个月 前同步成功
通知
30
Star
25765
Fork
3216
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fetch
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7d92dff1
编写于
7月 17, 2023
作者:
J
Jake Champion
提交者:
Jake Champion
7月 18, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: when no body supplied, do not set bodyUsed to true
上级
0c1d2b97
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
0 deletion
+11
-0
fetch.js
fetch.js
+2
-0
test/test.js
test/test.js
+9
-0
未找到文件。
fetch.js
浏览文件 @
7d92dff1
...
...
@@ -162,6 +162,7 @@ if (support.iterable) {
}
function
consumed
(
body
)
{
if
(
body
.
_noBody
)
return
if
(
body
.
bodyUsed
)
{
return
Promise
.
reject
(
new
TypeError
(
'
Already read
'
))
}
...
...
@@ -231,6 +232,7 @@ function Body() {
this
.
bodyUsed
=
this
.
bodyUsed
this
.
_bodyInit
=
body
if
(
!
body
)
{
this
.
_noBody
=
true
;
this
.
_bodyText
=
''
}
else
if
(
typeof
body
===
'
string
'
)
{
this
.
_bodyText
=
body
...
...
test/test.js
浏览文件 @
7d92dff1
...
...
@@ -996,6 +996,15 @@ exercise.forEach(function(exerciseMode) {
assert
(
error
instanceof
TypeError
,
'
Promise rejected after body consumed
'
)
})
})
test
(
'
does not set bodyUsed to true if no body supplied
'
,
function
()
{
var
response
=
new
Response
();
assert
(
response
.
text
,
'
Body does not implement text
'
)
assert
.
equal
(
response
.
bodyUsed
,
false
)
response
.
text
()
assert
.
equal
(
response
.
bodyUsed
,
false
)
return
response
.
text
()
})
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录