From 8aac01fb2dac9ade22e25ac8e5cc0d885c4131ab Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sat, 1 Apr 2023 15:08:55 -0400 Subject: [PATCH] work around some weird content encoding glitch --- .../src/routes/(authed)/repl/[id].json/+server.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sites/svelte.dev/src/routes/(authed)/repl/[id].json/+server.js b/sites/svelte.dev/src/routes/(authed)/repl/[id].json/+server.js index 7a76b7c382..66de713ed0 100644 --- a/sites/svelte.dev/src/routes/(authed)/repl/[id].json/+server.js +++ b/sites/svelte.dev/src/routes/(authed)/repl/[id].json/+server.js @@ -66,7 +66,16 @@ export async function GET({ params }) { if (dev && !client) { // in dev with no local Supabase configured, proxy to production // this lets us at least load saved REPLs - return await fetch(`https://svelte.dev/repl/${params.id}.json`); + const res = await fetch(`https://svelte.dev/repl/${params.id}.json`); + + // returning the response directly results in a bizarre + // content encoding error, so we create a new one + return new Response(await res.text(), { + status: res.status, + headers: { + 'content-type': 'application/json', + }, + }); } if (!UUID_REGEX.test(params.id)) {