Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fuzzy-chairs-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/platform": patch
---

Document that `HttpClient.followRedirects` only sees redirects from `FetchHttpClient` when `FetchHttpClient.RequestInit` sets `redirect: "manual"`.
5 changes: 5 additions & 0 deletions packages/platform/src/FetchHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import * as internal from "./internal/fetchHttpClient.js"
export class Fetch extends Context.Tag(internal.fetchTagKey)<Fetch, typeof globalThis.fetch>() {}

/**
* Additional `RequestInit` options passed to `fetch`.
*
* Set `redirect: "manual"` when using `HttpClient.followRedirects`, otherwise
* `fetch` follows redirects itself.
*
* @since 1.0.0
* @category tags
*/
Expand Down
7 changes: 6 additions & 1 deletion packages/platform/src/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,12 @@ export const withCookiesRef: {
} = internal.withCookiesRef

/**
* Follows HTTP redirects up to a specified number of times.
* Follows HTTP redirects up to `maxRedirects` times (default `10`).
*
* `FetchHttpClient` lets `fetch` follow redirects itself, so none reach this
* client. To handle them here, provide `FetchHttpClient.RequestInit` with
* `{ redirect: "manual" }`. Browsers return opaque responses for manual
* redirects, so they cannot be followed there.
*
* @since 1.0.0
* @category redirects
Expand Down
Loading