mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-23 05:42:30 +00:00
parent
3f4520da67
commit
3463804a7c
42 changed files with 5174 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
|
@ -17,6 +18,7 @@ import (
|
|||
|
||||
"github.com/adnanh/webhook/internal/hook"
|
||||
"github.com/adnanh/webhook/internal/middleware"
|
||||
"github.com/clbanning/mxj"
|
||||
chimiddleware "github.com/go-chi/chi/middleware"
|
||||
"github.com/gorilla/mux"
|
||||
fsnotify "gopkg.in/fsnotify.v1"
|
||||
|
@ -264,6 +266,11 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
|||
} else {
|
||||
payload = valuesToMap(fd)
|
||||
}
|
||||
case strings.Contains(contentType, "xml"):
|
||||
payload, err = mxj.NewMapXmlReader(bytes.NewReader(body))
|
||||
if err != nil {
|
||||
log.Printf("[%s] error parsing JSON payload %+v\n", rid, err)
|
||||
}
|
||||
default:
|
||||
log.Printf("[%s] error parsing body payload due to unsupported content type header: %s\n", rid, contentType)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue