mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-14 01:24:54 +00:00
removed leftover debug trace, fixed a panic bug
This commit is contained in:
parent
baec1cadc5
commit
231426da57
2 changed files with 6 additions and 4 deletions
|
@ -105,9 +105,13 @@ func GetParameter(s string, params interface{}) (interface{}, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
|
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
|
||||||
|
if paramsValue := reflect.ValueOf(params); paramsValue.Kind() == reflect.Map {
|
||||||
if pValue, ok := params.(map[string]interface{})[p[0]]; ok {
|
if pValue, ok := params.(map[string]interface{})[p[0]]; ok {
|
||||||
return GetParameter(p[1], pValue)
|
return GetParameter(p[1], pValue)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if pValue, ok := params.(map[string]interface{})[p[0]]; ok {
|
if pValue, ok := params.(map[string]interface{})[p[0]]; ok {
|
||||||
return pValue, true
|
return pValue, true
|
||||||
|
|
|
@ -172,8 +172,6 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
hook.ParseJSONParameters(&headers, &query, &payload)
|
hook.ParseJSONParameters(&headers, &query, &payload)
|
||||||
|
|
||||||
fmt.Printf("%+v", payload)
|
|
||||||
|
|
||||||
// handle hook
|
// handle hook
|
||||||
go handleHook(hook, &headers, &query, &payload, &body)
|
go handleHook(hook, &headers, &query, &payload, &body)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue