Skip to content

Commit f446cc0

Browse files
committed
tweak
1 parent d21272d commit f446cc0

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/kit/src/runtime/server/respond.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,14 +682,10 @@ export async function internal_respond(request, options, manifest, state) {
682682

683683
// we can't load the endpoint from our own manifest,
684684
// so we need to make an actual HTTP request
685-
const fetchResponse = await fetch(request);
685+
const response = await fetch(request);
686686

687-
// the headers for the response needs to be mutable so that cookies can be added
688-
return new Response(fetchResponse.body, {
689-
status: fetchResponse.status,
690-
statusText: fetchResponse.statusText,
691-
headers: new Headers(fetchResponse.headers)
692-
});
687+
// clone the response so that headers are mutable (https://github.com/sveltejs/kit/issues/13857)
688+
return new Response(response.body, response);
693689
} catch (e) {
694690
// TODO if `e` is instead named `error`, some fucked up Vite transformation happens
695691
// and I don't even know how to describe it. need to investigate at some point

0 commit comments

Comments
 (0)