From bad16bfcd05d239059da3d7196bbfbe64099fc45 Mon Sep 17 00:00:00 2001 From: Martin Treml Date: Mon, 11 Mar 2019 08:13:22 +0100 Subject: [PATCH] Give the user the choice to parse SystemHooks --- gitlab/gitlab.go | 3 --- gitlab/gitlab_test.go | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index dfefb1a..dffe9b9 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -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") diff --git a/gitlab/gitlab_test.go b/gitlab/gitlab_test.go index da5cd11..ed13f57 100644 --- a/gitlab/gitlab_test.go +++ b/gitlab/gitlab_test.go @@ -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)