From 283c7cddb50ef9071b307880d8f998ea019cf589 Mon Sep 17 00:00:00 2001 From: Tiago Ilieve Date: Tue, 22 Oct 2024 23:27:08 -0300 Subject: [PATCH] t: stream content directly There's no need to fetch the entire response body before returning it, given none of it will be used to change the response anyway. --- functions/t/[slug].ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/t/[slug].ts b/functions/t/[slug].ts index 7d6ef17..f52e6ea 100644 --- a/functions/t/[slug].ts +++ b/functions/t/[slug].ts @@ -9,8 +9,7 @@ export async function onRequestGet({ return new Response('Not Found', { status: 404 }); } - const content = await response.text(); - return new Response(content, { + return new Response(response.body, { headers: { 'Content-Type': 'text/html' }, }); }