You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- dedupePlugin: each deduplicated caller now receives an independent Response clone, preventing "body already used" errors when multiple concurrent callers consume the response body
8
+
9
+
Documentation
10
+
11
+
- deduplication: explained response cloning behaviour and auth header considerations for custom hashFn
12
+
- advanced: clarified that timeout acts as total duration cap including retry wait periods
Copy file name to clipboardExpand all lines: docs/advanced.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,8 @@ If you override retry behavior, make sure your custom logic still handles `Retry
189
189
// ffetch will wait until that date/time before retrying
190
190
```
191
191
192
+
> **Note**: The `timeout` option acts as a total duration cap across the entire request lifecycle, including retry wait periods. If a server responds with a large `Retry-After` value and the combined wait would exceed the configured `timeout`, the timeout fires and the request throws a `TimeoutError` — the retry wait is interrupted immediately. To allow indefinite waits, set `timeout: 0`.
193
+
192
194
## Circuit Breaker Pattern
193
195
194
196
The circuit breaker pattern protects your service from repeated failures by temporarily blocking requests after a threshold of consecutive errors. This helps prevent cascading failures and allows your system to recover gracefully.
Copy file name to clipboardExpand all lines: docs/deduplication.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,14 @@ const client = createClient({
56
56
- TTL eviction does not reject already in-flight request promises.
57
57
- Stream/FormData request bodies are skipped by the default hash strategy.
58
58
59
+
## Response Body Consumption
60
+
61
+
Each deduplicated caller receives an independent `Response` — the first caller gets the original, and each additional concurrent caller receives a clone. This means every caller can consume the response body (`.json()`, `.text()`, `.arrayBuffer()`, etc.) independently without conflict.
62
+
63
+
Note: `response.url` and `response.redirected` are not preserved on cloned responses (they are read-only on constructed `Response` objects). This is a browser/runtime constraint, not specific to ffetch. In practice, API responses rarely require these properties.
64
+
65
+
If you need auth headers (e.g. `Authorization`, `Cookie`) to be part of the dedupe key, provide a custom `hashFn` that includes them — the default hash uses method, URL, and body only.
0 commit comments