Skip to content

Commit

Permalink
fix noStreaming
Browse files Browse the repository at this point in the history
  • Loading branch information
codehz committed Jun 10, 2024
1 parent bee95e7 commit 80e03b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
7 changes: 6 additions & 1 deletion index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 80e03b3

Please sign in to comment.