Bugfix: Fix #15004 by applying MDN recommended fix when proxying Response in page_loa...
authorDrew Silcock <drew.larry.harry.silcock@gmail.com>
Fri, 28 Nov 2025 21:06:17 +0000 (21:06 +0000)
committerGitHub <noreply@github.com>
Fri, 28 Nov 2025 21:06:17 +0000 (14:06 -0700)
commit977b8bd460378b661aed0290c1f2618174279ede
tree0202e9454d554fac6a766f0bd5b9aff8447f7032
parent9fda2fcdf29091151af19b3b6599c47b199cbe04
Bugfix: Fix #15004 by applying MDN recommended fix when proxying Response in page_load (#15005)

* Apply MDN recommended fix when proxying Response to avoid TypeError.

On Node v24+, the undici library used for HTTP has a Response class with
a private element. Proxying the response therefore fails when calling
clone() as the method returned by the proxy cannot access the private
state element.

* Use more comprehensive Response proxy fix that makes linter happy.

By using Object.defineProperty(), we make the function identical to
introspection. Also, the linter didn't like the `...args`.

* Add page to test undici Response TypeError.

* Add generated changeset file.

* Apply suggestion from @elliott-with-the-longest-name-on-github

---------

Co-authored-by: Elliott Johnson <hello@ell.iott.dev>
.changeset/tangy-donkeys-knock.md [new file with mode: 0644]
packages/kit/src/runtime/server/page/load_data.js
packages/kit/test/apps/basics/src/routes/load/server-response-clone/+page.js [new file with mode: 0644]
packages/kit/test/apps/basics/src/routes/load/server-response-clone/+page.svelte [new file with mode: 0644]