-
-
Notifications
You must be signed in to change notification settings - Fork 306
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
:
import Elysia from "elysia";
export const app = new Elysia().post("/stream", async function* () {
yield {hello: "world"};
yield {hello: "world"};
yield {hello: "world"};
});
app.listen(2345);
client.ts
:
import { treaty } from "@elysiajs/eden";
import type { app } from ".";
const client = treaty<typeof app>("http://localhost:2345");
const { data, error } = await client.stream.post();
if (!data) throw error;
for await (let item of data) {
console.log(item, typeof item);
}
What is the expected behavior?
% bun run client.ts
{
hello: "world",
} object
{
hello: "world",
} object
{
hello: "world",
} object
What do you see instead?
% bun run client.ts
{"hello":"world"}{"hello":"world"} string
{
hello: "world",
} object
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.
HK-SHAO, kravetsone and ap0nia
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working