Commit c3ca74ae authored by analog-nico's avatar analog-nico
Browse files

Fix for init calls after redirects

parent 9c829e37
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@ function ownCallback(err, httpResponse, body) {
    }
    }


    // Mimic original behavior of errors emitted by request with no error listener registered
    // 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) {
    if (err && _.isFunction(self._rp_callbackOrig) === false && self._rp_then_invoked !== true && self.listeners('error').length === 1) {
        throw err;
        throw err;
    }
    }


+6 −0
Original line number Original line Diff line number Diff line
@@ -576,6 +576,12 @@ describe('Request-Promise', function () {
            }).to.throw();
            }).to.throw();
        });
        });


        it('like emitting errors to the callback', function (done) {
            rp({}, function (err) {
                if (err) { done(); }
            });
        });

    });
    });


});
});