Skip to content

feat: throw error when maxRedirections is used with undici.request() #4311

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

Merged
merged 6 commits into from
Jul 3, 2025

Conversation

mcollina
Copy link
Member

@mcollina mcollina commented Jun 29, 2025

The maxRedirections option was removed in v7 but no error was thrown when users tried to use it, making migration confusing. Now throws a clear error message directing users to use the redirect interceptor instead.

Fixes #4310

🤖 Generated with Claude Code

This relates to...

Rationale

Changes

Features

Bug Fixes

Breaking Changes and Deprecations

Status

The maxRedirections option was removed in v7 but no error was thrown when users tried to use it, making migration confusing. Now throws a clear error message directing users to use the redirect interceptor instead.

Fixes #4310

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
CLAUDE.md Outdated
**WebAssembly Components:**
- HTTP parser is WebAssembly-based
- Requires Docker to rebuild
- Pre-built binaries included in `lib/llhttp/`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this?

Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but some test failures

The maxRedirections option was removed in v7 but no error was thrown when users tried to use it, making migration confusing. Now throws a clear error message directing users to use the redirect interceptor instead.

Changes:
- Add validation in Request constructor to throw error for maxRedirections > 0
- Allow maxRedirections: 0 for internal fetch usage
- Update redirect interceptor to work with new validation
- Fix failing tests by removing maxRedirections from request options
- Add CLAUDE.md to .gitignore

Fixes #4310

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina mcollina force-pushed the fix-maxredirections-error branch from 3d4aa95 to 7cee925 Compare June 30, 2025 13:12
mcollina added 2 commits June 30, 2025 15:28
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
mcollina added 2 commits July 1, 2025 14:27
Signed-off-by: Matteo Collina <hello@matteocollina.com>
Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina
Copy link
Member Author

mcollina commented Jul 1, 2025

@Ethan-Arrowood good spot!

Copy link
Collaborator

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 7aee33f into main Jul 3, 2025
51 of 52 checks passed
@github-actions github-actions bot mentioned this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

maxRedirections option doesn't work anymore since v7
4 participants