I am calling a GET api in my automation suite but not getting response back. Same API works from postman. I have plenty of console.log which are not getting printed. There are no errors too. Below is the snippet.
var deferred = protractor.promise.defer();
var options = {
method: "GET",
hostname: hostname,
port: 8080,
path: '/v1/fis/'+fiId+'/businessCustomers/'+userAuthId+'/approvals',
headers: {
'authorization': 'testclient',
'content-type': 'application/json',
'accept': 'application/json',
}
};
var req = http.request(options, function (response) {
browser.sleep(1000);
console.log('headers are:', options);
console.log('hostname is: ', hostname);
browser.sleep(1000);
console.log('STATUS for approval API : ' + res.statusCode);
var chunks = [];
response.on("data", function (chunk) {
console.log('in chunk block::');
chunks.push(chunk);
});
response.on("end", function () {
var body = Buffer.concat(chunks);
var finaljson = JSON.parse(body.toString());
console.log('finaljson is:****', finaljson);
successCallBack(finaljson.SuccessResponse);
});
});
req.end();
return deferred.promise;
};```
Any insights will be helpful. TIA!