From fe58908e9d1626a9637613003499ba7a68f4704a Mon Sep 17 00:00:00 2001 From: Marcos Candeia Date: Tue, 24 Sep 2024 18:58:49 -0300 Subject: [PATCH] Allow parse as json without content-length Signed-off-by: Marcos Candeia --- src/actors/proxy.ts | 2 +- src/actors/runtime.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actors/proxy.ts b/src/actors/proxy.ts index 89841af..1178108 100644 --- a/src/actors/proxy.ts +++ b/src/actors/proxy.ts @@ -83,7 +83,7 @@ export const actors = { : {}, }, body: JSON.stringify({ - args, + args: args ?? [], }), }, ); diff --git a/src/actors/runtime.ts b/src/actors/runtime.ts index d006086..e5519eb 100644 --- a/src/actors/runtime.ts +++ b/src/actors/runtime.ts @@ -144,7 +144,7 @@ export class ActorRuntime { return new Response(`method not found for the actor`, { status: 404 }); } let args = []; - if (req.headers.get("content-length") !== null) { + if (req.headers.get("content-type")?.includes("application/json")) { const { args: margs } = await req.json(); args = margs; }