Merge pull request #206 from dcj/feature/incoming-payload-content-type

added support for incoming-payload-content-type
This commit is contained in:
Adnan Hajdarević 2018-09-14 11:51:06 +02:00 committed by GitHub
commit f9e799fea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -229,7 +229,11 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
// parse body
var payload map[string]interface{}
// set contentType to IncomingPayloadContentType or header value
contentType := r.Header.Get("Content-Type")
if len(matchedHook.IncomingPayloadContentType) != 0 {
contentType = matchedHook.IncomingPayloadContentType
}
if strings.Contains(contentType, "json") {
decoder := json.NewDecoder(strings.NewReader(string(body)))