From 93cacc3a53bbd2a3ee6a47c454890bc4e541860e Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Sun, 6 Nov 2022 22:03:25 -0500 Subject: [PATCH] Fix bug where GET or HEAD action requests could not be made from the web client Closes #468 --- web/src/components/Notifications.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/components/Notifications.js b/web/src/components/Notifications.js index 87756b90..9a4baf7c 100644 --- a/web/src/components/Notifications.js +++ b/web/src/components/Notifications.js @@ -399,7 +399,9 @@ const performHttpAction = async (notification, action) => { const response = await fetch(action.url, { method: action.method ?? "POST", headers: action.headers ?? {}, - body: action.body ?? "" + // This must not null-coalesce to a non nullish value. Otherwise, the fetch API + // will reject it for "having a body" + body: action.body }); console.log(`[Notifications] HTTP user action response`, response); const success = response.status >= 200 && response.status <= 299;