Open HK-SHAO opened 1 month ago
will be fixed by #743 and https://github.com/elysiajs/eden/pull/114
will be fixed by #743 and elysiajs/eden#114
@remorses A similar problem occurs in response to new ReadableStream(), which I solved by adding an await delay(0) after each controller.enqueue()
@SaltyAom When I sleep
before each yield
, it prevents objects from sticking into strings, do you think this is a bug in Bun?
import Elysia from "elysia";
export const server = new Elysia().post("/stream", async function* () {
yield { hello: "world" };
await Bun.sleep(0);
yield { hello: "world" };
await Bun.sleep(0);
yield { hello: "world" };
});
What version of Elysia.JS is running?
1.1.4
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
server.ts
:client.ts
:What is the expected behavior?
What do you see instead?
Additional information
Sometimes numeric responses are merged together into a single number, and sometimes json obejct responses are merged into a single string. The same goes for non-asynchronous.