Skip to content

Commit

Permalink
feat: implement throwOnMaxRedirect option for RedirectHandler
Browse files Browse the repository at this point in the history
feat: add RedirectHandler invalid URL protocol test
  • Loading branch information
Mert Can Altin committed Dec 30, 2023
1 parent 35b049b commit 1792140
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/handler/RedirectHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class RedirectHandler {
? null
: parseLocation(statusCode, headers)

if (this.history.length >= this.maxRedirections) {
this.abort(new Error('max redirects'))
return
}

if (this.opts.origin) {
this.history.push(new URL(this.opts.path, this.opts.origin))
}
Expand Down

0 comments on commit 1792140

Please sign in to comment.