From 2a1790dd5f25f9eaaf40cfcf32229792220c7df6 Mon Sep 17 00:00:00 2001 From: Taichi Sasaki Date: Tue, 26 Sep 2023 22:49:49 +0900 Subject: [PATCH] Use RedirectSlashes middleware by default Goa mux --- http/mux.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/http/mux.go b/http/mux.go index f918c877fd..8098b2bdb0 100644 --- a/http/mux.go +++ b/http/mux.go @@ -8,6 +8,7 @@ import ( "regexp" chi "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" ) type ( @@ -85,6 +86,7 @@ func NewMuxer() ResolverMuxer { w.WriteHeader(http.StatusNotFound) enc.Encode(NewErrorResponse(ctx, fmt.Errorf("404 page not found"))) // nolint:errcheck })) + r.Use(middleware.RedirectSlashes) return &mux{Router: r, wildcards: make(map[string]string)} }