Skip to content

Commit 49ecbd6

Browse files
committed
Add duplex option
Signed-off-by: Marcos Candeia <[email protected]>
1 parent c23eaa6 commit 49ecbd6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/actors/stubutil.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ export const createHttpInvoker = <
521521
fetcher(url, {
522522
credentials: actorsServer?.credentials,
523523
method: "POST",
524+
// @ts-expect-error: its ok because deno fetch does not have this but browsers does
525+
duplex: "half" as const, // Add this line for browser compatibility
524526
headers: {
525527
"Content-Type": "application/octet-stream",
526528
"Transfer-Encoding": "chunked",
@@ -530,6 +532,10 @@ export const createHttpInvoker = <
530532
: {},
531533
},
532534
body: requestReadable,
535+
}).catch((err) => {
536+
recvChan.close(err);
537+
sendChan.close(err);
538+
throw err;
533539
}).then(async (response) => {
534540
if (!response.ok) {
535541
throw new Error(`HTTP error! status: ${response.status}`);

0 commit comments

Comments
 (0)