I've written the following code which runs ok (got HTTP response of 200
) using the request library.
var request = require('request');
var auth = Buffer.from(`${oD.des.User}:${oD.des.Password}`).toString('base64');
var options = {
'method': 'GET',
'url': oD.dest.URL + path,
'headers': {
'Authorization': 'Basic ' + auth,
'Proxy-Authorization': `Bearer ${accesstoken}`
}
};
return await request(options, function (error, response) {
if (error) {
throw new Error(error);
}
console.log(response.body);
});
Now I'm doing the same with exactly the same value with superagent
and I get an error.
var auth = Buffer.from(`${oD.des.User}:${oD.des.Password}`).toString('base64');
return superagent
.get(oD.dest.URL + path)
.set('Proxy-Authorization', `Bearer ${accesstoken}}`)
.set('Authorization', 'Basic ' + auth)
.end((err, res) => {
console.log(err);
});
Here I got an error, why???
0: Error: getaddrinfo ENOTFOUND fdev.wa.glb.corp.srd fdev.wa.glb.corp.srd:443
[[StableObjectId]]: 1
code: "ENOTFOUND"
errno: "ENOTFOUND"
I'm struggling with it for almost two days.