Commit 593f3b37 authored by analog-nico's avatar analog-nico
Browse files

Reverted disallowing streaming

parent f96e9f89
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -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) {
    require('cls-bluebird')(ns);
};
+18 −16
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ var url = require('url');
var Bluebird = require('bluebird');
var childProcess = require('child_process');
var path = require('path');
var es = require('event-stream');
var bodyParser = require('body-parser');


@@ -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 () {

            return rp('http://localhost:4000/302')
@@ -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 () {