Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ovh): disable deletion of 0 or empty string params #15

Merged
merged 2 commits into from
Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <vincent.giersch@ovh.net>",
Expand Down