关于 fetch 的一个问题
資深大佬 : lisianthus 0
为什么第二种写法会报错:
fetch('xxx').then(res => res.json()); //ok fetch('xxx').then(Response.prototype.json.call); //TypeError: undefined is not a function
如果把 fetch 返回的 Stream 对象打印出来,用 Store as global variable 保存到变量 temp1 是可以正常使用 Response.prototype.json.call 的:
Response.prototype.json.call(temp1).then(console.log); //ok
大佬有話說 (9)