Skip to content

Commit

Permalink
[fix] set rawBody to null when body is nullish in simulated load fetch (
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry authored Aug 26, 2021
1 parent 5777cda commit f44693a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/polite-donkeys-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

avoid setting rawBody/body to an empty Uint8Array when a load's fetch function is called with no body during SSR
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/load_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export async function load_node({
method: opts.method || 'GET',
headers,
path: relative,
rawBody: new TextEncoder().encode(/** @type {string} */ (opts.body)),
rawBody: opts.body == null ? null : new TextEncoder().encode(opts.body),
query: new URLSearchParams(search)
},
options,
Expand Down

0 comments on commit f44693a

Please sign in to comment.