webhook: add JSON envelope
This commit is contained in:
parent
a19365123f
commit
8c282fdb5a
@ -97,9 +97,15 @@ func (h *WebhookNotifier) Configure(config *config.NotifierConfig) (bool, error)
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type notificationEnvelope struct {
|
||||||
|
Notification struct {
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (h *WebhookNotifier) Send(notification database.VulnerabilityNotification) error {
|
func (h *WebhookNotifier) Send(notification database.VulnerabilityNotification) error {
|
||||||
// Marshal notification.
|
// Marshal notification.
|
||||||
jsonNotification, err := json.Marshal(notification.Name)
|
jsonNotification, err := json.Marshal(notificationEnvelope{struct{ Name string }{notification.Name}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not marshal: %s", err)
|
return fmt.Errorf("could not marshal: %s", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user