From 80e03b38b70b76f48f2043172e3a1b59bd157223 Mon Sep 17 00:00:00 2001 From: codehz Date: Mon, 10 Jun 2024 19:02:31 +0800 Subject: [PATCH] fix noStreaming --- example/index.ts | 1 + index.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/example/index.ts b/example/index.ts index f688a8b..9c20b7a 100644 --- a/example/index.ts +++ b/example/index.ts @@ -8,6 +8,7 @@ Bun.serve({ const response = await router.serve(request, { Shell: ExampleShell, bootstrapModules: ["/hydrate.js"], + noStreaming: true }); if (response) return response; return new Response("Not found", { diff --git a/index.tsx b/index.tsx index 0298af6..5147e1d 100644 --- a/index.tsx +++ b/index.tsx @@ -111,7 +111,12 @@ export class StaticRouters { } ); if (noStreaming) { - await stream.allReady; + return new Response(await Bun.readableStreamToBlob(stream), { + headers: { + "Content-Type": "text/html; charset=utf-8", + "Cache-Control": "no-store", + }, + }); } return new Response(stream, { headers: {