From 80d523f06ee1e0ea3f0ad0934fc32520d029e901 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Mon, 30 Jan 2023 01:35:32 +0000 Subject: [PATCH] fixing #21 - bad only handling JSON bodies now --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index f0b3771..2202410 100644 --- a/src/index.ts +++ b/src/index.ts @@ -89,10 +89,10 @@ function parseBody( contentType: string | undefined, ): object | string { if (body) { - if (contentType === 'application/json' && typeof body === 'string') { - return JSON.parse(body); - } - if (contentType === 'text/plain') { + if (contentType === 'application/json') { + if (typeof body === 'string') { + return JSON.parse(body); + } return body; } }