From 8f6006a610fb6d6c7b8d14209a7323338a8964ff Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 28 Jan 2025 13:48:09 +1300 Subject: [PATCH] fix HttpServerRequest.arrayBuffer for bun & web handlers (#4353) --- .changeset/old-moose-appear.md | 6 ++++++ packages/platform-bun/src/internal/httpServer.ts | 4 ++-- packages/platform/src/internal/httpServerRequest.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/old-moose-appear.md diff --git a/.changeset/old-moose-appear.md b/.changeset/old-moose-appear.md new file mode 100644 index 00000000000..eef93629641 --- /dev/null +++ b/.changeset/old-moose-appear.md @@ -0,0 +1,6 @@ +--- +"@effect/platform-bun": patch +"@effect/platform": patch +--- + +fix HttpServerRequest.arrayBuffer for bun & web handlers diff --git a/packages/platform-bun/src/internal/httpServer.ts b/packages/platform-bun/src/internal/httpServer.ts index c85cc148805..1e760cc46ac 100644 --- a/packages/platform-bun/src/internal/httpServer.ts +++ b/packages/platform-bun/src/internal/httpServer.ts @@ -355,8 +355,8 @@ class ServerRequestImpl extends Inspectable.Class implements ServerRequest.HttpS private arrayBufferEffect: Effect.Effect | undefined get arrayBuffer(): Effect.Effect { - if (this.arrayBuffer) { - return this.arrayBuffer + if (this.arrayBufferEffect) { + return this.arrayBufferEffect } this.arrayBufferEffect = Effect.runSync(Effect.cached( Effect.tryPromise({ diff --git a/packages/platform/src/internal/httpServerRequest.ts b/packages/platform/src/internal/httpServerRequest.ts index dc9d8eade58..68271fe9849 100644 --- a/packages/platform/src/internal/httpServerRequest.ts +++ b/packages/platform/src/internal/httpServerRequest.ts @@ -332,8 +332,8 @@ class ServerRequestImpl extends Inspectable.Class implements ServerRequest.HttpS private arrayBufferEffect: Effect.Effect | undefined get arrayBuffer(): Effect.Effect { - if (this.arrayBuffer) { - return this.arrayBuffer + if (this.arrayBufferEffect) { + return this.arrayBufferEffect } this.arrayBufferEffect = Effect.runSync(Effect.cached( Effect.tryPromise({