Open JannikZed opened 5 years ago
You need to do something like:
res = await fetch('https://www.XXXX.com/' + companyid + '/XXXX.json?filter=all&limit=50&offset=' + x, {
method: 'GET',
headers: headers,
proxy: 'https://XXXX'+sessionrand+':XXXXX@servercountry-nl.XXXXXXy.io:22225'
})
if (res.ok) {
var source = await res.json()
} else {
// Handle http errors here
}
^ That's the solution. It looks like your proxy setup is having issues, so you need to make sure the request is Ok before calling .json()
.
When making some tests with make-fetch-happen I faced the following problem:
I'm using a http proxy. The code look likes this:
I was using plain node-fetch before and just replaced it now with make-fetch-happen to add our proxy servers.
Do I miss something?