diff --git a/api/middleware.go b/api/middleware.go index 8093970..e7e00cb 100644 --- a/api/middleware.go +++ b/api/middleware.go @@ -63,7 +63,7 @@ func giteaOauthVerifyMiddleware(cfg *config.Config) mux.MiddlewareFunc { } } -func verifyWebhookDataMiddleware(cfg *config.Config, logger *zap.Logger) mux.MiddlewareFunc { +func storeWebhookDataMiddleware(logger *zap.Logger) mux.MiddlewareFunc { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var webhook map[string]interface{} diff --git a/api/routes_webhooks.go b/api/routes_webhooks.go index dd71ec2..571a310 100644 --- a/api/routes_webhooks.go +++ b/api/routes_webhooks.go @@ -44,6 +44,7 @@ func setupWebhookRoutes(params RouteParams) { webhookRouter := r.PathPrefix("/api").Subrouter() webhookRouter.Use(gitea.VerifyWebhookSignatureMiddleware(cfg.GiteaWebHookSecret)) + webhookRouter.Use(storeWebhookDataMiddleware(logger)) webhookRouter.HandleFunc("/webhooks/pull_request", webhookApi.handlePullRequest).Methods("POST") }