From c15fe4281ec5a16ee73656d54657919bc3ddc448 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 8 Aug 2024 21:56:58 -0700 Subject: [PATCH] common: fix auth http body --- server/src/fetch/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/fetch/index.ts b/server/src/fetch/index.ts index 96ecb2eb5b..c868e4c5fa 100644 --- a/server/src/fetch/index.ts +++ b/server/src/fetch/index.ts @@ -145,6 +145,11 @@ export function createStringOrBufferBody(headers: [string, string][], body: any) if (!hasHeader(headers, 'Content-Type')) setHeader(headers, 'Content-Type', contentType); + + if (!hasHeader(headers, 'Content-Length')) { + body = Buffer.from(body); + setHeader(headers, 'Content-Length', body.length.toString()); + } return body; }