mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-22 21:32:32 +00:00
Merge pull request #206 from dcj/feature/incoming-payload-content-type
added support for incoming-payload-content-type
This commit is contained in:
commit
f9e799fea0
2 changed files with 5 additions and 0 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue