Skip to content

Commit

Permalink
t: stream content directly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
myhro committed Oct 23, 2024
1 parent d3ed847 commit 55e44c7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions functions/t/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
});
}

0 comments on commit 55e44c7

Please sign in to comment.