mirror of https://github.com/certd/certd
parent
f0584c88e8
commit
1fe3365e10
|
@ -1,5 +1,6 @@
|
||||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||||
import qs from 'qs';
|
import qs from 'qs';
|
||||||
|
|
||||||
@IsNotification({
|
@IsNotification({
|
||||||
name: 'webhook',
|
name: 'webhook',
|
||||||
title: '自定义webhook',
|
title: '自定义webhook',
|
||||||
|
@ -135,12 +136,13 @@ export class WebhookNotification extends BaseNotification {
|
||||||
this.headers.split('\n').forEach(item => {
|
this.headers.split('\n').forEach(item => {
|
||||||
item = item.trim();
|
item = item.trim();
|
||||||
if (item) {
|
if (item) {
|
||||||
const arr = item.split('=');
|
const eqIndex = item.indexOf('=');
|
||||||
if (arr.length !== 2) {
|
if (eqIndex <= 0) {
|
||||||
this.logger.warn('header格式错误,请使用=号', item);
|
this.logger.warn('header格式错误,请使用=号分割', item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
headers[arr[0]] = arr[1];
|
const key = item.substring(0, eqIndex);
|
||||||
|
headers[key] = item.substring(eqIndex + 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue