From 8c282fdb5a73e2b6579bbafb367c68d45766f760 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 24 Feb 2016 15:05:39 -0500 Subject: [PATCH] webhook: add JSON envelope --- notifier/notifiers/webhook.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/notifier/notifiers/webhook.go b/notifier/notifiers/webhook.go index 21f48277..9fa1c655 100644 --- a/notifier/notifiers/webhook.go +++ b/notifier/notifiers/webhook.go @@ -97,9 +97,15 @@ func (h *WebhookNotifier) Configure(config *config.NotifierConfig) (bool, error) return true, nil } +type notificationEnvelope struct { + Notification struct { + Name string + } +} + func (h *WebhookNotifier) Send(notification database.VulnerabilityNotification) error { // Marshal notification. - jsonNotification, err := json.Marshal(notification.Name) + jsonNotification, err := json.Marshal(notificationEnvelope{struct{ Name string }{notification.Name}}) if err != nil { return fmt.Errorf("could not marshal: %s", err) }