I am getting socket hang up eror message while sending request. As per observation request is getting processed but at the time of sending response, I am getting below response:
{
"success":false,
"error":{
"name":"RequestError","message":"Error: socket hang up","cause":{"code":"ECONNRESET"},
"error":{"code":"ECONNRESET"},
"options":{"uri":"request url","simple":true,"resolveWithFullResponse":false,"transform2xxOnly":false}
}
}
I am using below code:
var options = {
uri: 'request url',
};
request(options).then(function(data) {
res.json({
success: true,
data: data
});
})
.catch(function (err) {
res.json({
success: false,
error: err,
});
});