mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
use .bytes() but it is broken on errors
This commit is contained in:
@@ -159,6 +159,9 @@ export async function render(
|
||||
|
||||
// Buffer the entire response and return it all at once
|
||||
const htmlStream = renderToHtml(rscPayload, meta.modules, signal);
|
||||
const result = await htmlStream.bytes();
|
||||
|
||||
/*
|
||||
const chunks: Uint8Array[] = [];
|
||||
const reader = htmlStream.getReader();
|
||||
|
||||
@@ -194,6 +197,7 @@ export async function render(
|
||||
result.set(chunk, offset);
|
||||
offset += chunk.length;
|
||||
}
|
||||
*/
|
||||
|
||||
const opts = als?.getStore()?.responseOptions ?? { headers: {} };
|
||||
const { headers, ...response_options } = opts;
|
||||
|
||||
@@ -162,7 +162,7 @@ class RscInjectionStream extends EventEmitter {
|
||||
|
||||
const { resolve, promise, reject } = Promise.withResolvers<void>();
|
||||
this.finished = promise;
|
||||
this.finalize = resolve;
|
||||
this.finalize = x => (controller.close(), resolve(x));
|
||||
this.reject = reject;
|
||||
|
||||
rscPayload.on("data", this.writeRscData.bind(this));
|
||||
|
||||
Reference in New Issue
Block a user