nodejitsu-api
Advanced tools
Comparing version 0.5.3 to 0.6.0
@@ -176,2 +176,3 @@ 'use strict'; | ||
proxy = this.options.get('proxy'), | ||
optHeaders, | ||
self = this, | ||
@@ -202,2 +203,9 @@ opts = {}; | ||
optHeaders = this.options.get('headers'); | ||
if (optHeaders) { | ||
Object.keys(optHeaders).forEach(function each(field) { | ||
opts.headers[field] = optHeaders[field]; | ||
}); | ||
} | ||
if (proxy) opts.proxy = proxy; | ||
@@ -229,6 +237,10 @@ | ||
} | ||
// Only add the response argument when people ask for it | ||
if (callback.length === 3) return callback(error, result, res); | ||
callback(error, result); | ||
// | ||
// If we don't pass a callback here, don't try and do anything fancy | ||
// | ||
if (callback) { | ||
// Only add the response argument when people ask for it | ||
if (callback.length === 3) return callback(error, result, res); | ||
callback(error, result); | ||
} | ||
}); | ||
@@ -271,5 +283,8 @@ }; | ||
// Defer all the error handling to the request method | ||
var req = self.request(options, callback); | ||
var req = self.request(options); | ||
if (!req) return; | ||
req.on('error', callback); | ||
req.on('response', callback.bind(null, null)); | ||
// Notify that we have started the upload procedure and give it a reference | ||
@@ -276,0 +291,0 @@ // to the stat. |
{ | ||
"name": "nodejitsu-api", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"description": "nodejitsu API client wrapper", | ||
@@ -5,0 +5,0 @@ "keywords": ["nodejitsu", "nodejitsu-api"], |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
67901
1534
0