From b4861d1082cc8658a4ec37bb96b8a01d21a3ddef Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Wed, 11 Jan 2023 20:32:35 -0500 Subject: [PATCH] fix(middleware): don't parse the payload string into JSON If we don't have `request.body`, don't parse the string payload into JSON, to avoid issues like #775 --- src/middleware/node/get-payload.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/node/get-payload.ts b/src/middleware/node/get-payload.ts index 69f58498..e85a4b49 100644 --- a/src/middleware/node/get-payload.ts +++ b/src/middleware/node/get-payload.ts @@ -28,7 +28,7 @@ export function getPayload(request: IncomingMessage): Promise (data += chunk)); request.on("end", () => { try { - resolve(JSON.parse(data)); + resolve(data); } catch (error: any) { error.message = "Invalid JSON"; error.status = 400;