next.js
0027c842 - fix: fixed dedupe response cloning (#73274)

Commit
1 year ago
fix: fixed dedupe response cloning (#73274) Based on our testing, we've observed a bug with undici that presents as the `Body has already been consumed` error while trying to call `Response#clone()`. The problem was resolved using a custom cloning implementation. Rather than relying on the existing `Response#clone()`, we call `ReadableStream#tee()` on the body and re-create the `Response` object. This has the same underlying behaviour as `Response#clone()` (admittedly with more steps), but explicitly manages the stream management correctly during response cloning.
Author
Parents
Loading