gitlab_hook.go
func (g GitlabHook) handleToken(r *http.Request, body []byte, secret string) error {
	token := r.Header.Get("X-Gitlab-Token")
	if token != "" {
		if secret == "" {
			Logger().Print("Unable to verify request. Secret not set in caddyfile!\n")
		} else {
			if token != secret {
				return errors.New("Unable to verify request. The token and specified secret do not match!")
			}
		}
	}

	return nil
}
func (g GitlabHook) handleToken(r *http.Request, body []byte, secret string) error {
	token := r.Header.Get("X-Gitlab-Token")
	if token != "" {
		if secret == "" {
			Logger().Print("Unable to verify request. Secret not set in caddyfile!\n")
		} else {
			if token != secret {
				return errors.New("Unable to verify request. The token and specified secret do not match!")
			}
		}
	}

	return nil
}
func ( g GitlabHook ) handleToken ( r * http . Request , body [ ] byte , secret string ) error { token := r . Header . Get ( " " ) if token != " " { if secret == " " { Logger ( ) . Print ( " \n " ) } else { if token != secret { return errors . New ( " " ) } } } return nil }
// handleToken checks for an optional token in the request. GitLab's webhook tokens are just
// simple strings that get sent as a header with the hook request. If one
// exists, verify that it matches the secret in the Caddy configuration.
handleToken checks for an optional token in the request . GitLab s webhook tokens are just simple strings that get sent as a header with the hook request . If one exists verify that it matches the secret in the Caddy configuration .