-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…3521) * Add failing test for #3473 prerender error body used already * Fix reading from same response body twice during prerender * Fix quotes * Add changeset * Fix casing for internal variables * Revert change of cloning response as bug was actually in prerender.js * Avoid reading response body twice * Revert "Avoid reading response body twice" This reverts commit cecf7dd. Revert being stupid #1 * Revert "Revert change of cloning response as bug was actually in prerender.js" This reverts commit 5e5f30b. Revert being stupid #2 * store buffered depenedency bodies for prerendering * failing test for non-buffered endpoint data * use buffered body if available, otherwise buffer Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
b3d3f5c
commit 2dc7774
Showing
9 changed files
with
116 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
[fix] reading from same response body twice during prerender (#3473) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/kit/test/prerendering/basics/src/routes/fetch-endpoint/buffered.json.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export async function get() { | ||
return { | ||
body: { answer: 42 } | ||
}; | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/kit/test/prerendering/basics/src/routes/fetch-endpoint/buffered.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script context="module"> | ||
/** @type {import('@sveltejs/kit').Load} */ | ||
export async function load({ fetch }) { | ||
const url = '/fetch-endpoint/buffered.json'; | ||
const res = await fetch(url); | ||
return { | ||
props: await res.json() | ||
}; | ||
} | ||
</script> | ||
|
||
<script> | ||
/** @type {number} */ | ||
export let answer; | ||
</script> | ||
|
||
<h1>the answer is {answer}</h1> |
5 changes: 5 additions & 0 deletions
5
packages/kit/test/prerendering/basics/src/routes/fetch-endpoint/not-buffered.json.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export async function get() { | ||
return { | ||
body: { answer: 42 } | ||
}; | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/kit/test/prerendering/basics/src/routes/fetch-endpoint/not-buffered.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script context="module"> | ||
/** @type {import('@sveltejs/kit').Load} */ | ||
export async function load({ fetch }) { | ||
const url = '/fetch-endpoint/not-buffered.json'; | ||
const res = await fetch(url); | ||
return { | ||
props: { | ||
headers: res.headers | ||
} | ||
}; | ||
} | ||
</script> | ||
|
||
<script> | ||
/** @type {Headers} */ | ||
export let headers; | ||
</script> | ||
|
||
<h1>content-type: {headers.get('content-type')}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters