Skip to content

Commit 1792140

Browse files
author
Mert Can Altin
committed
feat: implement throwOnMaxRedirect option for RedirectHandler
feat: add RedirectHandler invalid URL protocol test
1 parent 35b049b commit 1792140

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/handler/RedirectHandler.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ class RedirectHandler {
9191
? null
9292
: parseLocation(statusCode, headers)
9393

94+
if (this.history.length >= this.maxRedirections) {
95+
this.abort(new Error('max redirects'))
96+
return
97+
}
98+
9499
if (this.opts.origin) {
95100
this.history.push(new URL(this.opts.path, this.opts.origin))
96101
}

0 commit comments

Comments
 (0)