Browse Source

Hotfix for "Hastic instance name #558":

- alert -> payload
pull/1/head
rozetko 6 years ago
parent
commit
436c2a7cab
  1. 7
      server/src/services/notification_service.ts

7
server/src/services/notification_service.ts

@ -61,10 +61,11 @@ export async function sendWebhook(payload: any) {
payload.instanceName = HASTIC_INSTANCE_NAME;
let data;
if(HASTIC_WEBHOOK_TYPE === ContentType.JSON) {
payload = JSON.stringify(alert);
data = JSON.stringify(payload);
} else if(HASTIC_WEBHOOK_TYPE === ContentType.URLENCODED) {
payload = querystring.stringify(alert);
data = querystring.stringify(payload);
} else {
throw new Error(`Unknown webhook type: ${HASTIC_WEBHOOK_TYPE}`);
}
@ -73,7 +74,7 @@ export async function sendWebhook(payload: any) {
const options = {
method: 'POST',
url: HASTIC_WEBHOOK_URL,
data: payload,
data,
headers: { 'Content-Type': HASTIC_WEBHOOK_TYPE }
};

Loading…
Cancel
Save