From af07c7f050b1458b5b6b4cc36c7613f53e28b276 Mon Sep 17 00:00:00 2001 From: Jan Hartje Date: Mon, 18 Jul 2022 16:04:27 +0000 Subject: [PATCH] feat(notification): add Authorization Header option to backend --- server/notification-providers/webhook.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/notification-providers/webhook.js b/server/notification-providers/webhook.js index d4933cf02..ca1c106a1 100644 --- a/server/notification-providers/webhook.js +++ b/server/notification-providers/webhook.js @@ -16,20 +16,22 @@ class Webhook extends NotificationProvider { msg, }; let finalData; - let config = {}; + let config = { + headers: {} + }; if (notification.webhookContentType === "form-data") { finalData = new FormData(); finalData.append("data", JSON.stringify(data)); - - config = { - headers: finalData.getHeaders(), - }; - + config.headers = finalData.getHeaders(); } else { finalData = data; } + if (notification.webhookAuthorizationHeader) { + config.headers["Authorization"] = notification.webhookAuthorizationHeader; + } + await axios.post(notification.webhookURL, finalData, config); return okMsg;