Skip to content

Commit f44693a

Browse files
authored
[fix] set rawBody to null when body is nullish in simulated load fetch (#2295)
1 parent 5777cda commit f44693a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/polite-donkeys-learn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
avoid setting rawBody/body to an empty Uint8Array when a load's fetch function is called with no body during SSR

packages/kit/src/runtime/server/page/load_node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export async function load_node({
151151
method: opts.method || 'GET',
152152
headers,
153153
path: relative,
154-
rawBody: new TextEncoder().encode(/** @type {string} */ (opts.body)),
154+
rawBody: opts.body == null ? null : new TextEncoder().encode(opts.body),
155155
query: new URLSearchParams(search)
156156
},
157157
options,

0 commit comments

Comments
 (0)