Give the user the choice to parse SystemHooks
This commit is contained in:
@@ -89,9 +89,6 @@ func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)
|
||||
return nil, ErrInvalidHTTPMethod
|
||||
}
|
||||
|
||||
// Add SystemHookEvents to event slice to allow parsing
|
||||
events = append(events, SystemHookEvents)
|
||||
|
||||
// If we have a Secret set, we should check the MAC
|
||||
if len(hook.secret) > 0 {
|
||||
signature := r.Header.Get("X-Gitlab-Token")
|
||||
|
||||
@@ -306,7 +306,7 @@ func TestSystemHooks(t *testing.T) {
|
||||
var parseError error
|
||||
var results interface{}
|
||||
server := newServer(func(w http.ResponseWriter, r *http.Request) {
|
||||
results, parseError = hook.Parse(r, tc.event)
|
||||
results, parseError = hook.Parse(r, SystemHookEvents, tc.event)
|
||||
})
|
||||
defer server.Close()
|
||||
req, err := http.NewRequest(http.MethodPost, server.URL+path, payload)
|
||||
|
||||
Reference in New Issue
Block a user