diff --git a/lib/http_client.js b/lib/http_client.js index c2eb04d..1578fc7 100644 --- a/lib/http_client.js +++ b/lib/http_client.js @@ -128,6 +128,14 @@ client.prototype.request = function(method, path, params, callback){ }); }); + // This should only occur for errors such as a socket hang up prior to any + // data being received, or SSL-related issues. + req.on('error', function(err) { + if(typeof callback == 'function'){ + callback(err, null, 0); + } + }); + if(['POST', 'PUT'].indexOf(http_options['method']) >= 0){ req.write(body); }