eh-api-client
Advanced tools
Comparing version 0.48.3 to 0.49.0
14
index.js
@@ -26,8 +26,12 @@ var | ||
retryStrategy: function(err, params) { | ||
if(params && params.method && params.method.toLowerCase() !== "get") { | ||
return false; | ||
const method = params && params.method && params.method.toLowerCase() || '' | ||
if (err.code === 'EAI_AGAIN' || err.code === 'EHOSTUNREACH') { | ||
// for this kind of errors the request definitely has not reached the destionation | ||
return true | ||
} | ||
// only retry if got an ECONNRESET/ETIMEDOUT/ESOCKETTIMEDOUT/EAI_AGAIN/ECONNREFUSED error | ||
// https://man7.org/linux/man-pages/man3/errno.3.html | ||
return err.code === "ECONNRESET" || err.code === "ETIMEDOUT" || err.code === "ESOCKETTIMEDOUT" || err.code === 'EAI_AGAIN' || err.code === 'ECONNREFUSED'; | ||
if(method === "get") { | ||
// https://man7.org/linux/man-pages/man3/errno.3.html | ||
return err.code === "ECONNRESET" || err.code === "ETIMEDOUT" || err.code === "ESOCKETTIMEDOUT" || err.code === 'ECONNREFUSED'; | ||
} | ||
return false | ||
} | ||
@@ -34,0 +38,0 @@ }; |
{ | ||
"name": "eh-api-client", | ||
"version": "0.48.3", | ||
"version": "0.49.0", | ||
"description": "Node.js rest client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
46704
1496