Skip to content

fix(runner): keep default max redirects for library options - #2755

Merged
Mzack9999 merged 1 commit into
devfrom
fix/library-max-redirects
Nov 21, 2026
Merged

Mzack9999 merged 1 commit into
devfrom
fix/library-max-redirects

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Fixes #2754

A zero MaxRedirects now keeps the client default (10). Only CLI change: -fr -maxr 0 follows up to 10 redirects instead of none.

Summary by CodeRabbit

  • Bug Fixes
    • Redirect handling now uses the standard redirect limit when no positive custom limit is provided, rather than overriding that default with a zero or negative value.
    • Positive custom redirect limits continue to be honored, so explicitly configured redirect behavior remains unchanged.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

New now preserves the HTTP client’s default MaxRedirects when the configured value is zero or negative. A new test checks the default value and confirms that a positive configured value is used.

Changes

Redirect limit handling

Layer / File(s) Summary
Apply and verify redirect limits
runner/runner.go, runner/maxredirects_test.go
New overrides the HTTP client’s default only when MaxRedirects is greater than zero. The test checks the default for zero and preserves an explicit value of 3.

Estimated code review effort: 2 (Simple) | ~8 minutes

Suggested reviewers: mzack9999, antcybersec

Merge Risk: Minimal · up to a6988

Library users who set FollowRedirects to true and leave MaxRedirects at zero will now follow up to 10 redirects instead of getting a 3xx response. The change is small and reversible, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: when library options set FollowRedirects and MaxRedirects is zero, the runner keeps the httpx client default of 10 instead of overriding it. The title matches the runn…
Linked Issues check Passed Issue #2754 requires that library-built runner.Options with MaxRedirects at 0 keep the client default of 10 when FollowRedirects is true. The whole-PR diff (merge base to head) changes New in …
Out of Scope Changes check Passed Both changed files relate to the objective of #2754. runner/runner.go contains the single guarded assignment that implements the fix. runner/maxredirects_test.go adds a focused test for that assignmen…
Full details: Title check

Explanation

The title names the main change: when library options set FollowRedirects and MaxRedirects is zero, the runner keeps the httpx client default of 10 instead of overriding it. The title matches the runner.go change (assign MaxRedirects only when greater than zero) and the added test in runner/maxredirects_test.go. It follows the conventional-commit style and is specific enough for a teammate scanning history.

Full details: Linked Issues check

Explanation

Issue #2754 requires that library-built runner.Options with MaxRedirects at 0 keep the client default of 10 when FollowRedirects is true. The whole-PR diff (merge base to head) changes New in runner/runner.go so that httpxOptions.MaxRedirects is assigned only when options.MaxRedirects > 0. A zero value therefore leaves the httpx client default in place. A non-zero value still overrides the default. The new test TestNewKeepsDefaultMaxRedirects in runner/maxredirects_test.go checks both cases: zero yields httpx.DefaultOptions.MaxRedirects, and 3 yields 3. The test was not executed during this assessment. The verdict rests on the source diff. No coding requirement from #2754 remains unmet.

Full details: Out of Scope Changes check

Explanation

Both changed files relate to the objective of #2754. runner/runner.go contains the single guarded assignment that implements the fix. runner/maxredirects_test.go adds a focused test for that assignment. The PR description notes that the CLI combination -fr -maxr 0 now follows up to 10 redirects. This follows directly from the same Options handling and is the intended effect of the zero-value rule, so it does not count as an unrelated change. No unrelated edits appear in the diff.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the redirect trail
Zero keeps the default without fail
Three is set when asked to be
Tests confirm the values agree
Then closes runners, hops away

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3cfdf99f-22ee-4f36-b904-81377f8c547e
Commits

Reviewing files that changed from the base of the PR and between 402fd34 and a69888b.

Files selected for processing: 2

  • runner/maxredirects_test.go
  • runner/runner.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@Mzack9999
Mzack9999 merged commit 987ab27 into dev Nov 21, 2026
12 checks passed
@Mzack9999
Mzack9999 deleted the fix/library-max-redirects branch November 21, 2026 17:49
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.

Library options with FollowRedirects follow no redirects

2 participants