From 3e472d340fa160695a412244e8b44a0a3aff5833 Mon Sep 17 00:00:00 2001 From: Clovis Durand Date: Wed, 4 Oct 2023 17:23:54 +0200 Subject: [PATCH] Update request function to handle 201/204 success status codes --- lib/ovh.es5.js | 2 +- lib/ovh.es6.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ovh.es5.js b/lib/ovh.es5.js index 209f314..71d4cd7 100644 --- a/lib/ovh.es5.js +++ b/lib/ovh.es5.js @@ -401,7 +401,7 @@ var Ovh = function () { _this2.debug('[OVH] API response to', options.method, options.path, ':', body); } - if (res.statusCode !== 200) { + if (res.statusCode > 299 || res.statusCode < 200) { callback(res.statusCode, response ? response.message : response); } else { // Return a proxy (for potential next request) diff --git a/lib/ovh.es6.js b/lib/ovh.es6.js index 3d0013b..dfe794f 100644 --- a/lib/ovh.es6.js +++ b/lib/ovh.es6.js @@ -405,7 +405,7 @@ class Ovh { ); } - if (res.statusCode !== 200) { + if (res.statusCode > 299 || res.statusCode < 200) { callback(res.statusCode, response ? response.message : response); } else { @@ -487,4 +487,4 @@ class Ovh { module.exports = function (params) { return new Ovh(params || {}); -}; \ No newline at end of file +};