From 13fe4422162b53b188de352abab1b5241027baad Mon Sep 17 00:00:00 2001 From: Thibaut Rousseau Date: Wed, 9 May 2018 18:19:18 +0200 Subject: [PATCH] feat: Add content-type header to webhook requests --- api/hook/webhook.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/hook/webhook.go b/api/hook/webhook.go index 07f2bbe..22f28ed 100644 --- a/api/hook/webhook.go +++ b/api/hook/webhook.go @@ -30,6 +30,10 @@ func sendWebHook(hook *tat.HookJSON, path string, topic tat.Topic, headerName, h req, _ := http.NewRequest("POST", path, bytes.NewReader(data)) + // The data sent is always JSON, set this header to allow consumers + // to parse the body of the request easily + req.Header.Add("Content-Type", "application/json") + if headerName != "" && headerValue != "" { req.Header.Add(headerName, headerValue) }