superagent-bluebird-promise
Advanced tools
Comparing version 2.1.1 to 3.0.0
15
index.js
@@ -9,2 +9,6 @@ // From https://gist.github.com/epeli/11209665 | ||
Promise.config({ | ||
// Enable cancellation. | ||
cancellation: true | ||
}); | ||
// Create custom error type. | ||
@@ -61,3 +65,3 @@ // Create a new object, that prototypally inherits from the Error constructor. | ||
return new Promise(function(resolve, reject) { | ||
return new Promise(function(resolve, reject, onCancel) { | ||
req.end(function(err, res) { | ||
@@ -77,7 +81,6 @@ if (typeof res !== "undefined" && res.status >= 400) { | ||
}); | ||
}) | ||
.cancellable() | ||
.caught(Promise.CancellationError, function(err) { | ||
req.abort(); | ||
throw err; | ||
onCancel(function() { | ||
req.abort(); | ||
}); | ||
}); | ||
@@ -84,0 +87,0 @@ }; |
{ | ||
"name": "superagent-bluebird-promise", | ||
"description": "Add promise support to superagent using Bluebird", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
@@ -18,3 +18,3 @@ "bugs": { | ||
"peerDependencies": { | ||
"bluebird": "2.x", | ||
"bluebird": "3.x", | ||
"superagent": "1.x" | ||
@@ -28,6 +28,6 @@ }, | ||
"test-watch": "NODE_ENV=test node_modules/.bin/mocha -w --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter", | ||
"test": "node_modules/.bin/coffeelint test/* & jshint *.json *.js & NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter" | ||
"test": "node_modules/.bin/coffeelint test/* & jshint *.json *.js && NODE_ENV=test node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register -R mocha-unfunk-reporter" | ||
}, | ||
"devDependencies": { | ||
"bluebird": "^2.9.24", | ||
"bluebird": "^3.0.5", | ||
"chai": "^3.3.0", | ||
@@ -34,0 +34,0 @@ "coffee-script": "^1.9.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14
88
35063