From 330f418b742e424fe033d69bcd917f761856fa3e Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Thu, 4 Dec 2025 21:17:16 +0100 Subject: [PATCH] fix headers (#1615) --- .../notifications/webhook/src/index.test.ts | 2 +- packages/notifications/webhook/src/index.ts | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/notifications/webhook/src/index.test.ts b/packages/notifications/webhook/src/index.test.ts index cd18c958b..ccb008c26 100644 --- a/packages/notifications/webhook/src/index.test.ts +++ b/packages/notifications/webhook/src/index.test.ts @@ -29,7 +29,7 @@ describe("Webhook sendTest", () => { expect.objectContaining({ method: "post", body: expect.any(String), - headers: undefined, + headers: { "Content-Type": "application/json" }, }), ); diff --git a/packages/notifications/webhook/src/index.ts b/packages/notifications/webhook/src/index.ts index b6dbd9508..7a51c23a7 100644 --- a/packages/notifications/webhook/src/index.ts +++ b/packages/notifications/webhook/src/index.ts @@ -40,7 +40,9 @@ export const sendAlert = async ({ body: JSON.stringify(body), headers: notificationData.webhook.headers ? transformHeaders(notificationData.webhook.headers) - : undefined, + : { + "Content-Type": "application/json", + }, }); } catch (err) { console.log(err); @@ -84,7 +86,9 @@ export const sendRecovery = async ({ body: JSON.stringify(body), headers: notificationData.webhook.headers ? transformHeaders(notificationData.webhook.headers) - : undefined, + : { + "Content-Type": "application/json", + }, }); } catch (err) { console.log(err); @@ -126,7 +130,9 @@ export const sendDegraded = async ({ body: JSON.stringify(body), headers: notificationData.webhook.headers ? transformHeaders(notificationData.webhook.headers) - : undefined, + : { + "Content-Type": "application/json", + }, }); } catch (err) { console.log(err); @@ -156,7 +162,11 @@ export const sendTest = async ({ const response = await fetch(url, { method: "post", body: JSON.stringify(body), - headers: headers ? transformHeaders(headers) : undefined, + headers: headers + ? transformHeaders(headers) + : { + "Content-Type": "application/json", + }, }); if (!response.ok) { throw new Error("Failed to send test"); -- 2.54.0