temp checkin

This commit is contained in:
Dean Karn
2018-07-26 08:54:32 -07:00
parent e452811cf1
commit 1d0289a3ae
13 changed files with 2806 additions and 2834 deletions
+11 -11
View File
@@ -9,6 +9,17 @@ import (
"net/http"
)
// parse errors
var (
ErrEventNotSpecifiedToParse = errors.New("no Event specified to parse")
ErrInvalidHTTPMethod = errors.New("invalid HTTP Method")
ErrMissingGitLabEventHeader = errors.New("missing X-Gitlab-Event Header")
ErrMissingGitLabTokenHeader = errors.New("missing X-Gitlab-Token Header")
ErrEventNotFound = errors.New("event not defined to be parsed")
ErrParsingPayload = errors.New("error parsing payload")
// ErrHMACVerificationFailed = errors.New("HMAC verification failed")
)
// GitLab hook types
const (
PushEvents Event = "Push Hook"
@@ -58,17 +69,6 @@ func New(options ...Option) (*Webhook, error) {
return hook, nil
}
// parse errros
var (
ErrEventNotSpecifiedToParse = errors.New("No Event specified to parse")
ErrInvalidHTTPMethod = errors.New("Invalid HTTP Method")
ErrMissingGitLabEventHeader = errors.New("Missing X-Gitlab-Event Header")
ErrMissingGitLabTokenHeader = errors.New("Missing X-Gitlab-Token Header")
ErrEventNotFound = errors.New("Event not defined to be parsed")
ErrParsingPayload = errors.New("Error parsing payload")
// ErrHMACVerificationFailed = errors.New("HMAC verification failed")
)
// Parse verifies and parses the events specified and returns the payload object or an error
func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error) {
defer func() {