Loading lib/rp.js +8 −0 Original line number Original line Diff line number Diff line Loading @@ -142,4 +142,12 @@ request.Request.prototype.promise = function RP$promise() { }; }; function RP$noStreaming() { throw new Error('Request-Promise does not support streaming the response. Please use the original Request library for that.'); } request.Request.prototype.pipe = RP$noStreaming; request.Request.prototype.pipeDest = RP$noStreaming; module.exports = request; module.exports = request; test/spec/request-test.js +16 −17 Original line number Original line Diff line number Diff line Loading @@ -894,23 +894,6 @@ describe('Request-Promise', function () { }); }); }); }); it('for piping data while also the promise is used', function (done) { var req = rp('http://localhost:4000/200'); var _data; req.pipe(es.wait(function (err, data) { _data = data.toString(); })); req.then(function (body) { expect(body).to.eql('GET /200'); expect(_data).to.eql('GET /200'); done(); }); }); it('for requests with a redirect', function () { it('for requests with a redirect', function () { return rp('http://localhost:4000/302') return rp('http://localhost:4000/302') Loading Loading @@ -970,6 +953,22 @@ describe('Request-Promise', function () { }); }); it('by not allowing the use of .pipe(...)', function () { expect(function () { rp('http://localhost:4000/200').pipe(); }).to.throw(); }); it('by not allowing the use of .pipeDest(...)', function () { expect(function () { rp('http://localhost:4000/200').pipeDest(); }).to.throw(); }); }); }); describe('should still allow to require Request independently', function (done) { describe('should still allow to require Request independently', function (done) { Loading Loading
lib/rp.js +8 −0 Original line number Original line Diff line number Diff line Loading @@ -142,4 +142,12 @@ request.Request.prototype.promise = function RP$promise() { }; }; function RP$noStreaming() { throw new Error('Request-Promise does not support streaming the response. Please use the original Request library for that.'); } request.Request.prototype.pipe = RP$noStreaming; request.Request.prototype.pipeDest = RP$noStreaming; module.exports = request; module.exports = request;
test/spec/request-test.js +16 −17 Original line number Original line Diff line number Diff line Loading @@ -894,23 +894,6 @@ describe('Request-Promise', function () { }); }); }); }); it('for piping data while also the promise is used', function (done) { var req = rp('http://localhost:4000/200'); var _data; req.pipe(es.wait(function (err, data) { _data = data.toString(); })); req.then(function (body) { expect(body).to.eql('GET /200'); expect(_data).to.eql('GET /200'); done(); }); }); it('for requests with a redirect', function () { it('for requests with a redirect', function () { return rp('http://localhost:4000/302') return rp('http://localhost:4000/302') Loading Loading @@ -970,6 +953,22 @@ describe('Request-Promise', function () { }); }); it('by not allowing the use of .pipe(...)', function () { expect(function () { rp('http://localhost:4000/200').pipe(); }).to.throw(); }); it('by not allowing the use of .pipeDest(...)', function () { expect(function () { rp('http://localhost:4000/200').pipeDest(); }).to.throw(); }); }); }); describe('should still allow to require Request independently', function (done) { describe('should still allow to require Request independently', function (done) { Loading