Merge pull request #469 from ollien/fetch-get-body

Fix bug where GET or HEAD action requests could not be made from the web client
pull/476/head
Philipp C. Heckel 2022-11-07 05:05:51 -05:00 committed by GitHub
commit f3174f822f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -399,7 +399,9 @@ const performHttpAction = async (notification, action) => {
const response = await fetch(action.url, { const response = await fetch(action.url, {
method: action.method ?? "POST", method: action.method ?? "POST",
headers: action.headers ?? {}, 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); console.log(`[Notifications] HTTP user action response`, response);
const success = response.status >= 200 && response.status <= 299; const success = response.status >= 200 && response.status <= 299;