[英]Intermittent download failures of json using node-fetch
我試圖從 API 下載 json 響應,它失敗了 10 次中有 9 次。
響應相當大 - 大約 90mb。 在 postman 中下載,webbrowser 每次都可以工作,但在節點中,響應似乎被扭曲並且不是有效的 json。 有時它會起作用。
使用 node-fetch-2.6.1 嘗試了 v16.1.0 和 v14.15.5
const fetch = require('node-fetch');
fetch('https://xxxxx', {
headers: { 'Authorization': 'Basic xxxxxx',
},
})
.then(res => res.json())
.then(json => console.log(json));
有任何想法嗎?
node-fetch 中的可疑錯誤 - 使用 node-libcurl 解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.