Skip to content

Commit

Permalink
fix(ovh): disable deletion of 0 or empty string params
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <[email protected]>
  • Loading branch information
bnjjj committed Aug 8, 2016
1 parent 835a178 commit e214e84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/ovh.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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();
});
Expand Down
8 changes: 4 additions & 4 deletions lib/ovh.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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());
}
});
Expand Down

0 comments on commit e214e84

Please sign in to comment.