mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-09-19 20:14:52 -04:00
feat(notification): add additional Header to webhook
This commit is contained in:
parent
3c5de1c889
commit
b879428a03
3 changed files with 46 additions and 13 deletions
|
@ -28,8 +28,15 @@ class Webhook extends NotificationProvider {
|
|||
finalData = data;
|
||||
}
|
||||
|
||||
if (notification.webhookAuthorizationHeader) {
|
||||
config.headers["Authorization"] = notification.webhookAuthorizationHeader;
|
||||
if (notification.webhookAdditionalHeaders) {
|
||||
try {
|
||||
config.headers = {
|
||||
...config.headers,
|
||||
...JSON.parse(notification.webhookAdditionalHeaders)
|
||||
};
|
||||
} catch (err) {
|
||||
throw "Addional Headers is not a valid JSON";
|
||||
}
|
||||
}
|
||||
|
||||
await axios.post(notification.webhookURL, finalData, config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue