Bug Description
Documentation on main references a throwOnMaxRedirects field that can be set on the RedirectInterceptorOpts to throw an error if the maximum number of redirects are reached. I do not see throwOnMaxRedirects in the undici code aside from where it's mentioned in that documentation. That field seems to not be defined on the RedirectInterceptorOpts.
I do however see throwOnMaxRedirect (no trailing s) that is actually used to trigger exceptions. Just like throwOnMaxRedirects, throwOnMaxRedirect is not defined in the interceptor.d.ts type declarations/definitions for the pre-defined redirect interceptor opts.
Reproducible By
$ git clone https://github.com/nodejs/undici
$ grep -wrn 'throwOnMaxRedirects' ./undici
./undici/docs/docs/api/Dispatcher.md:965: redirect({ maxRedirections: 3, throwOnMaxRedirects: true })
$ grep -wrn 'throwOnMaxRedirect' ./undici
./undici/test/interceptors/redirect.js:456: throwOnMaxRedirect: true
./undici/test/redirect-request.js:416: throwOnMaxRedirect: true
./undici/lib/handler/redirect-handler.js:95: if (this.opts.throwOnMaxRedirect && this.history.length >= this.maxRedirections) {
const res = await request(urlToFetch, {
...opts,
dispatcher: getGlobalDispatcher().compose(
interceptors.redirect({
maxRedirections: 1,
throwOnMaxRedirects: true
})
),
Expected Behavior
-
Documentation specifies how someone can properly trigger an exception using either throwOnMaxRedirect or throwOnMaxRedirects (not sure which one is correct, but personal preference is throwOnMaxRedirects
-
RedirectInterceptorOpts are updated to accept an optional throwOnMaxRedirects (or throwOnMaxRedirect if that's the preference) boolean for typescript users
Logs & Screenshots
Environment
macOS Sequoia 15.5 (24F74)
pnpm 10.11.0
node 24.2.0
undici 7.13.0
Additional context
Bug Description
Documentation on
mainreferences athrowOnMaxRedirectsfield that can be set on theRedirectInterceptorOptsto throw an error if the maximum number of redirects are reached. I do not seethrowOnMaxRedirectsin the undici code aside from where it's mentioned in that documentation. That field seems to not be defined on theRedirectInterceptorOpts.I do however see
throwOnMaxRedirect(no trailings) that is actually used to trigger exceptions. Just likethrowOnMaxRedirects,throwOnMaxRedirectis not defined in theinterceptor.d.tstype declarations/definitions for the pre-defined redirect interceptor opts.Reproducible By
Expected Behavior
Documentation specifies how someone can properly trigger an exception using either
throwOnMaxRedirectorthrowOnMaxRedirects(not sure which one is correct, but personal preference isthrowOnMaxRedirectsRedirectInterceptorOptsare updated to accept an optionalthrowOnMaxRedirects(orthrowOnMaxRedirectif that's the preference) boolean for typescript usersLogs & Screenshots
Environment
macOS Sequoia 15.5 (24F74)
pnpm 10.11.0
node 24.2.0
undici 7.13.0
Additional context