From 63786d05e03f584f80d32f56bc77f4a8a87e4d2f Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Sun, 19 Nov 2023 16:09:13 -0500 Subject: [PATCH] fix(web): superfluous write --- pkg/web/context.go | 1 + pkg/web/git.go | 7 ++++--- pkg/web/goget.go | 6 +----- pkg/web/logging.go | 5 +++++ pkg/web/util.go | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pkg/web/context.go b/pkg/web/context.go index e8aae8f7e..ccba92776 100644 --- a/pkg/web/context.go +++ b/pkg/web/context.go @@ -32,6 +32,7 @@ func NewContextHandler(ctx context.Context) func(http.Handler) http.Handler { ctx = db.WithContext(ctx, dbx) ctx = store.WithContext(ctx, datastore) r = r.WithContext(ctx) + next.ServeHTTP(w, r) }) } diff --git a/pkg/web/git.go b/pkg/web/git.go index 364530f62..c03e56afd 100644 --- a/pkg/web/git.go +++ b/pkg/web/git.go @@ -72,7 +72,7 @@ var ( }, []string{"repo", "file"}) ) -func withParams(h http.Handler) http.Handler { +func withParams(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() cfg := config.FromContext(ctx) @@ -97,7 +97,8 @@ func withParams(h http.Handler) http.Handler { // Add repo suffix (.git) r.URL.Path = fmt.Sprintf("%s.git/%s", repo, vars["file"]) r = mux.SetURLVars(r, vars) - h.ServeHTTP(w, r) + + next.ServeHTTP(w, r) }) } @@ -111,7 +112,7 @@ func GitController(_ context.Context, r *mux.Router) { } // Handle go-get - r.Handle(basePrefix, withParams(withAccess(GoGetHandler{}))).Methods(http.MethodGet) + r.Handle(basePrefix, withParams(withAccess(http.HandlerFunc(GoGetHandler)))).Methods(http.MethodGet) } var gitRoutes = []GitRoute{ diff --git a/pkg/web/goget.go b/pkg/web/goget.go index d8e65a400..3c9c49719 100644 --- a/pkg/web/goget.go +++ b/pkg/web/goget.go @@ -36,11 +36,7 @@ Redirecting to docs at