diff --git a/middleware/strip.go b/middleware/strip.go index ce8ebfcc..6a8f4437 100644 --- a/middleware/strip.go +++ b/middleware/strip.go @@ -16,6 +16,8 @@ func StripSlashes(next http.Handler) http.Handler { rctx := chi.RouteContext(r.Context()) if rctx != nil && rctx.RoutePath != "" { path = rctx.RoutePath + } else if r.URL.RawPath != "" { + path = r.URL.RawPath } else { path = r.URL.Path } @@ -43,6 +45,8 @@ func RedirectSlashes(next http.Handler) http.Handler { rctx := chi.RouteContext(r.Context()) if rctx != nil && rctx.RoutePath != "" { path = rctx.RoutePath + } else if r.URL.RawPath != "" { + path = r.URL.RawPath } else { path = r.URL.Path }