Loading lib/rp.js +6 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ function ownCallback(err, httpResponse, body) { throw thrownException; } // Mimic original behavior of errors emitted by request with no error listener registered if (err && self._rp_then_invoked !== true && self.listeners('error').length === 1) { throw err; } } var originalInit = request.Request.prototype.init; Loading Loading @@ -86,6 +91,7 @@ request.Request.prototype.init = function (options) { }; request.Request.prototype.then = function (onFulfilled, onRejected) { this._rp_then_invoked = true; return this._rp_promise.then(onFulfilled, onRejected); }; Loading test/request-test.js +10 −0 Original line number Diff line number Diff line Loading @@ -568,4 +568,14 @@ describe('Request-Promise', function () { }); describe("should not alter Request's original behavior", function () { it('like emitting errors with no listener', function () { expect(function () { rp({}); }).to.throw(); }); }); }); Loading
lib/rp.js +6 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ function ownCallback(err, httpResponse, body) { throw thrownException; } // Mimic original behavior of errors emitted by request with no error listener registered if (err && self._rp_then_invoked !== true && self.listeners('error').length === 1) { throw err; } } var originalInit = request.Request.prototype.init; Loading Loading @@ -86,6 +91,7 @@ request.Request.prototype.init = function (options) { }; request.Request.prototype.then = function (onFulfilled, onRejected) { this._rp_then_invoked = true; return this._rp_promise.then(onFulfilled, onRejected); }; Loading
test/request-test.js +10 −0 Original line number Diff line number Diff line Loading @@ -568,4 +568,14 @@ describe('Request-Promise', function () { }); describe("should not alter Request's original behavior", function () { it('like emitting errors with no listener', function () { expect(function () { rp({}); }).to.throw(); }); }); });