Skip to content

Commit

Permalink
ensure rpc chunks are always delimited on write (#3710)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Oct 1, 2024
1 parent 16fe968 commit dc14e96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-singers-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/rpc-http": patch
---

ensure rpc chunks are always delimited on write
3 changes: 1 addition & 2 deletions packages/rpc-http/src/HttpRpcRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export const toHttpApp = <R extends Router.RpcRouter<any, any>>(self: R): App.De
ServerResponse.stream(
handler(_).pipe(
Stream.chunks,
Stream.map((_) => JSON.stringify(Chunk.toArray(_))),
Stream.intersperse("\n"),
Stream.map((_) => JSON.stringify(Chunk.toReadonlyArray(_)) + "\n"),
Stream.encodeText,
Stream.provideContext(context)
),
Expand Down

0 comments on commit dc14e96

Please sign in to comment.