Loading lib/rp.js +0 −8 Original line number Original line Diff line number Diff line Loading @@ -148,14 +148,6 @@ 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; request.bindCLS = function RP$bindCLS(ns) { request.bindCLS = function RP$bindCLS(ns) { require('cls-bluebird')(ns); require('cls-bluebird')(ns); }; }; Loading test/spec/request-test.js +18 −16 Original line number Original line Diff line number Diff line Loading @@ -7,6 +7,7 @@ var url = require('url'); var Bluebird = require('bluebird'); var Bluebird = require('bluebird'); var childProcess = require('child_process'); var childProcess = require('child_process'); var path = require('path'); var path = require('path'); var es = require('event-stream'); var bodyParser = require('body-parser'); var bodyParser = require('body-parser'); Loading Loading @@ -920,6 +921,23 @@ 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 @@ -979,22 +997,6 @@ 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 () { describe('should still allow to require Request independently', function () { Loading Loading
lib/rp.js +0 −8 Original line number Original line Diff line number Diff line Loading @@ -148,14 +148,6 @@ 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; request.bindCLS = function RP$bindCLS(ns) { request.bindCLS = function RP$bindCLS(ns) { require('cls-bluebird')(ns); require('cls-bluebird')(ns); }; }; Loading
test/spec/request-test.js +18 −16 Original line number Original line Diff line number Diff line Loading @@ -7,6 +7,7 @@ var url = require('url'); var Bluebird = require('bluebird'); var Bluebird = require('bluebird'); var childProcess = require('child_process'); var childProcess = require('child_process'); var path = require('path'); var path = require('path'); var es = require('event-stream'); var bodyParser = require('body-parser'); var bodyParser = require('body-parser'); Loading Loading @@ -920,6 +921,23 @@ 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 @@ -979,22 +997,6 @@ 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 () { describe('should still allow to require Request independently', function () { Loading