diff --git a/pkg/notifier/events.go b/pkg/notifier/events.go index 4870c28..b51c45e 100644 --- a/pkg/notifier/events.go +++ b/pkg/notifier/events.go @@ -1,15 +1,20 @@ package notifier import ( + "encoding/json" "github.com/sirupsen/logrus" "io/ioutil" "net/http" ) func handleEventsRequest(w http.ResponseWriter, r *http.Request) { - event, err := ioutil.ReadAll(r.Body) + data, err := ioutil.ReadAll(r.Body) if err != nil { logrus.WithError(err).Info("failed to read request body") } - logrus.WithField("event", string(event)).Info("received event") + event := make(map[string]interface{}) + if err := json.Unmarshal(data, &event); err != nil { + logrus.WithError(err).WithField("data", string(data)).Error("failed to unmarshal json") + } + logrus.WithField("event", event).Info("received event") }