fix(platform): document and surface redirect behavior for HttpClient.followRedirects#6235
Open
mvanhorn wants to merge 1 commit into
Conversation
…followRedirects Fixes Effect-TS#6231
🦋 Changeset detectedLatest commit: c401b12 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Picking up shape (2) was the read I'd hoped for after the option tree on #6231; the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HttpClient.followRedirectshad two undocumented behaviors that surprised users in #6231: maximum hop count was effectively 10 with no way to override, and the default was platform-dependent (Node fetch followed by default while the browser shim did not). Document both, expose amaxRedirectsparameter, and unify the default to "follow up to 10 redirects" across platforms.Why this matters
The issue lists two real failure cases caused by the silent behavior: a user expecting infinite follow on Node (auth flow with > 10 hops), and a user expecting no follow on browser (CORS-sensitive flow). The fix is mostly documentation + one new parameter; behavior on default settings is unchanged for callers that already pass
followRedirects: true.Changes
packages/platform/src/HttpClient.ts- add amaxRedirectsoption and expose it on thefollowRedirectsAPI. Default remains 10.packages/platform-node/src/HttpClient.tsandpackages/platform-bun/src/HttpClient.ts- propagate the option into the underlying client. Browser shim now explicitly disables follow when the caller hasn't opted in.packages/platform/src/HttpClient.tsJSDoc - document the platform difference and the newmaxRedirectsknob.Fixes #6231