From a76bed3850f2bdbf57a633fc657e438ac56195e3 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 23 Nov 2024 11:40:46 +0100 Subject: [PATCH] fixup --- lib/handler/redirect-handler.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/handler/redirect-handler.js b/lib/handler/redirect-handler.js index e464c9d6aa3..5af1b39c670 100644 --- a/lib/handler/redirect-handler.js +++ b/lib/handler/redirect-handler.js @@ -49,7 +49,6 @@ class RedirectHandler { this.maxRedirections = maxRedirections this.handler = handler this.history = [] - this.redirectionLimitReached = false if (util.isStream(this.opts.body)) { // TODO (fix): Provide some way for the user to cache the file to e.g. /tmp @@ -101,9 +100,7 @@ class RedirectHandler { onHeaders (statusCode, rawHeaders, resume, statusText) { if (this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) { - this.redirectionLimitReached = true - this.abort(new Error('max redirects')) - return + throw new Error('max redirects') } // https://tools.ietf.org/html/rfc7231#section-6.4.2