Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect Handler throwOnMaxRedirect #2436

Closed
ronag opened this issue Nov 14, 2023 · 5 comments
Closed

Redirect Handler throwOnMaxRedirect #2436

ronag opened this issue Nov 14, 2023 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ronag
Copy link
Member

ronag commented Nov 14, 2023

Would like to have an option where the redirect handler throws on max redirects instead of just forwarding the result.

@ronag ronag added the enhancement New feature or request label Nov 14, 2023
@ronag
Copy link
Member Author

ronag commented Nov 14, 2023

@metcoder95

@metcoder95
Copy link
Member

It should be a matter of calling this.abort(new Error('max redirects') if the flag is set to true, right here:

this.location = this.history.length >= this.maxRedirections || util.isDisturbed(this.opts.body)
? null
: parseLocation(statusCode, headers)

Do you have something else to cover in mind?

@metcoder95 metcoder95 added the good first issue Good for newcomers label Nov 15, 2023
@VigneshMurugan
Copy link

#2546

@metcoder95

@Lewiscowles1986
Copy link

See #951 as commented in #2260 the redirect interceptor and handler seem to lack any meaningful direct unit tests

@mertcanaltin
Copy link
Member

mertcanaltin commented Jan 17, 2024

landed: a7551ce

can I turn this issue off ?

@ronag ronag closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants