mirror of
https://github.com/adnanh/webhook.git
synced 2026-07-27 09:39:15 +08:00
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user