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");