From e214e8490bcb8523acdc6c7656a9a871baedca71 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen Date: Mon, 8 Aug 2016 17:52:20 +0200 Subject: [PATCH 1/2] fix(ovh): disable deletion of 0 or empty string params Signed-off-by: Benjamin Coenen --- lib/ovh.es5.js | 8 ++++---- lib/ovh.es6.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ovh.es5.js b/lib/ovh.es5.js index 7f9f835..98c51af 100644 --- a/lib/ovh.es5.js +++ b/lib/ovh.es5.js @@ -150,7 +150,7 @@ var Ovh = function () { return this.addApi(apiPath, api, apis); } - if (!apis[path]) { + if (apis[path] == null) { apis[path] = { _path: apis._path + '/' + path }; } @@ -279,7 +279,7 @@ var Ovh = function () { value: function request(httpMethod, path, params, callback, refer) { var _this2 = this; - if (!callback) { + if (callback == null) { callback = params; } @@ -345,7 +345,7 @@ var Ovh = function () { // Remove undefined values for (var k in params) { - if (params.hasOwnProperty(k) && !params[k]) { + if (params.hasOwnProperty(k) && params[k] == null) { delete params[k]; } } @@ -424,7 +424,7 @@ var Ovh = function () { if (typeof this.timeout === 'number') { req.on('socket', function (socket) { socket.setTimeout(_this2.timeout); - if (!socket._events.timeout) { + if (socket._events.timeout != null) { socket.on('timeout', function () { return req.abort(); }); diff --git a/lib/ovh.es6.js b/lib/ovh.es6.js index 48da9ec..3d0013b 100644 --- a/lib/ovh.es6.js +++ b/lib/ovh.es6.js @@ -136,7 +136,7 @@ class Ovh { return this.addApi(apiPath, api, apis); } - if (!apis[path]) { + if (apis[path] == null) { apis[path] = { _path: apis._path + '/' + path }; } @@ -271,7 +271,7 @@ class Ovh { * @param {Object} refer: The parent proxied object */ request(httpMethod, path, params, callback, refer) { - if (!callback) { + if (callback == null) { callback = params; } @@ -337,7 +337,7 @@ class Ovh { // Remove undefined values for (let k in params) { - if (params.hasOwnProperty(k) && !params[k]) { + if (params.hasOwnProperty(k) && params[k] == null) { delete params[k]; } } @@ -428,7 +428,7 @@ class Ovh { if (typeof(this.timeout) === 'number') { req.on('socket', (socket) => { socket.setTimeout(this.timeout); - if (!socket._events.timeout) { + if (socket._events.timeout != null) { socket.on('timeout', () => req.abort()); } }); From 12d6d1f550be45dcbc9522a1cf23d05d9e80fb5a Mon Sep 17 00:00:00 2001 From: Benjamin Coenen Date: Tue, 9 Aug 2016 16:26:04 +0200 Subject: [PATCH 2/2] bump version to 2.0.1 Signed-off-by: Benjamin Coenen --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce4eb83..e9034ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ovh", - "version": "2.0.0", + "version": "2.0.1", "description": "Official Node.js wrapper for the OVH APIs", "homepage": "http://ovh.github.io/node-ovh", "author": "Vincent Giersch ",