mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 18:24:03 +00:00
feat(notification): add Authorization Header option to backend
This commit is contained in:
parent
95dba6dcaf
commit
af07c7f050
1 changed files with 8 additions and 6 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue