From 2e7f2ae1a1d29388e1318beecf848ab7c612df72 Mon Sep 17 00:00:00 2001 From: grumbulon Date: Sat, 10 Jun 2023 14:32:58 -0400 Subject: [PATCH] change function name --- internal/api/api.go | 6 +++--- internal/api/helpers.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/api/api.go b/internal/api/api.go index c8efa2d..88f8bfa 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -33,7 +33,7 @@ func API() http.Handler { api.Use(jwtauth.Verifier(tokenAuth)) api.Use(jwtauth.Authenticator) - api.With(setDBMiddleware).With(pommeLogger).Post("/upload", ReceiveFile) + api.With(setDBMiddleware).With(setLoggerMiddleware).Post("/upload", ReceiveFile) }) // Open routes @@ -51,8 +51,8 @@ func API() http.Handler { render.JSON(w, r, resp) }), )) - api.With(setDBMiddleware).With(pommeLogger).Post("/create", NewUser) - api.With(setDBMiddleware).With(pommeLogger).Post("/login", Login) + api.With(setDBMiddleware).With(setLoggerMiddleware).Post("/create", NewUser) + api.With(setDBMiddleware).With(setLoggerMiddleware).Post("/login", Login) api.Post("/logout", Logout) }) diff --git a/internal/api/helpers.go b/internal/api/helpers.go index b359257..5dbf2f8 100644 --- a/internal/api/helpers.go +++ b/internal/api/helpers.go @@ -51,7 +51,7 @@ func setDBMiddleware(next http.Handler) http.Handler { }) } -func pommeLogger(next http.Handler) http.Handler { +func setLoggerMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { logger := newResponder() ctx := context.WithValue(r.Context(), keyLoggerContextID, logger)