From 92c1fbddf922449fb2f1eadc3c7aaaed1a72637a Mon Sep 17 00:00:00 2001 From: Jonathan Putney Date: Sat, 26 Oct 2024 22:17:02 -0400 Subject: [PATCH] Fixed an issue with an empty response body from commit --- src/constants/default_settings.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/constants/default_settings.ts b/src/constants/default_settings.ts index b97ff10..33c9b6b 100644 --- a/src/constants/default_settings.ts +++ b/src/constants/default_settings.ts @@ -23,7 +23,11 @@ export const DefaultSettings: Settings = { fetchMode: "cors", responseHandler: async function (response: Response): Promise { if (typeof response !== "undefined") { - const httpResult = JSON.parse(await response.text()); + const responseText = await response.text(); + let httpResult = null; + if (responseText) { + httpResult = JSON.parse(responseText); + } if ( httpResult === null || !{}.hasOwnProperty.call(httpResult, "result")