chain-node
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -12,11 +12,3 @@ var request = require('request'); | ||
function HttpUtility(c) { | ||
if(c.auth == null) { | ||
c.auth = "GUEST-TOKEN"; | ||
}; | ||
this.auth = c.auth; | ||
if (c.url == null) { | ||
c.url = URL; | ||
}; | ||
this.url = c.url; | ||
this.url = c.url || URL; | ||
} | ||
@@ -41,10 +33,27 @@ | ||
request(r, function(err, resp, body) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (Math.floor(resp.statusCode / 100) != 2) { | ||
err = body; | ||
err = new Error("Chain SDK error: bad status code " + resp.statusCode.toString() + ". See 'resp' property for more detail."); | ||
err.resp = resp; | ||
return cb(err); | ||
} | ||
if(usingJson) { | ||
cb(err, body); | ||
} else { | ||
cb(err, JSON.parse(body)); | ||
return cb(err, body); | ||
} | ||
var parsed; | ||
try { | ||
parsed = JSON.parse(body); | ||
} catch (e) { | ||
err = new Error("Chain SDK error: could not decode JSON response. See 'error' and 'resp' properties for more detail."); | ||
err.error = e; | ||
err.resp = resp; | ||
return cb(err); | ||
} | ||
cb(null, parsed); | ||
}); | ||
@@ -51,0 +60,0 @@ }; |
{ | ||
"name": "chain-node", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "The Official Node.js SDK for Chain's Bitcoin API", | ||
@@ -28,2 +28,6 @@ "main": "index.js", | ||
}, | ||
"devDependencies": { | ||
"mocha": "~2.2.0", | ||
"nock": "~1.6.0" | ||
}, | ||
"files": [ | ||
@@ -30,0 +34,0 @@ "index.js", |
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
14863
7
229
2
1