summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-01-06 06:55:58 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-01-06 06:55:58 -0500
commit50fa6d1aea40e30b8178ec3d71f59b6ae7dd1d31 (patch)
treec1272edcfad7e1a986bc54c3e9253bd918c88542
parent482158d2bbc59be80e916bd2197f0fc609d9bc73 (diff)
parent23a8d954d9c18de6dc6187ba9af7539e81b33d91 (diff)
downloadchat-50fa6d1aea40e30b8178ec3d71f59b6ae7dd1d31.tar.gz
chat-50fa6d1aea40e30b8178ec3d71f59b6ae7dd1d31.tar.bz2
chat-50fa6d1aea40e30b8178ec3d71f59b6ae7dd1d31.zip
Merge pull request #1817 from apskim/patch-1
[Fix #1669] Allow parameters in Content-Type of incoming webhook request
-rw-r--r--web/web.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/web/web.go b/web/web.go
index 6e0e8df32..1f693c873 100644
--- a/web/web.go
+++ b/web/web.go
@@ -1017,7 +1017,8 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
r.ParseForm()
var parsedRequest *model.IncomingWebhookRequest
- if r.Header.Get("Content-Type") == "application/json" {
+ contentType := r.Header.Get("Content-Type")
+ if strings.Split(contentType, "; ")[0] == "application/json" {
parsedRequest = model.IncomingWebhookRequestFromJson(r.Body)
} else {
parsedRequest = model.IncomingWebhookRequestFromJson(strings.NewReader(r.FormValue("payload")))