我正在尝试将request.status
传递给渔获物,但仍显示
无法获取。这是我的代码:
let url = "https://api.coindesk.com/v1/bpi/currentprice.json";
fetch(url).then(function(request){
if(!request.ok){
throw Error(request.status);
} else {
return request;
}
}).then(function(response) {
console.log("ok");
}).catch(function(error) {
console.log(error);
});