diff options
Diffstat (limited to 'web/web.go')
-rw-r--r-- | web/web.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/web/web.go b/web/web.go index da7eff13d..bf985a5a0 100644 --- a/web/web.go +++ b/web/web.go @@ -850,7 +850,12 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) { r.ParseForm() - props := model.MapFromJson(strings.NewReader(r.FormValue("payload"))) + var props map[string]string + if r.Header.Get("Content-Type") == "application/json" { + props = model.MapFromJson(r.Body) + } else { + props = model.MapFromJson(strings.NewReader(r.FormValue("payload"))) + } text := props["text"] if len(text) == 0 { |