From d0afc3df946985f80e8e03176c493a1535443249 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 14 Oct 2014 22:43:29 -0700 Subject: [PATCH] returning error from notification sendJson for debugging --- plugin/notify/notification.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/notify/notification.go b/plugin/notify/notification.go index d3b2de6a..982be477 100644 --- a/plugin/notify/notification.go +++ b/plugin/notify/notification.go @@ -105,11 +105,14 @@ func getBuildUrl(context *model.Request) string { // helper fuction to sent HTTP Post requests // with JSON data as the payload. -func sendJson(url string, payload []byte, headers map[string]string) { +func sendJson(url string, payload []byte, headers map[string]string) error { client := &http.Client{} buf := bytes.NewBuffer(payload) req, err := http.NewRequest("POST", url, buf) + if err != nil { + return err + } req.Header.Set("Content-Type", "application/json") if headers != nil { @@ -120,7 +123,8 @@ func sendJson(url string, payload []byte, headers map[string]string) { resp, err := client.Do(req) if err != nil { - return + return err } resp.Body.Close() + return nil }