good morning!!!!

Skip to content
Snippets Groups Projects
Commit 8ba8bba0 authored by Garet Halliday's avatar Garet Halliday
Browse files

allow trailing slashes

parent e48c5692
No related branches found
No related tags found
No related merge requests found
Pipeline #22298 passed
...@@ -78,7 +78,16 @@ func _main(ctx context.Context) error { ...@@ -78,7 +78,16 @@ func _main(ctx context.Context) error {
handler.ServeHTTP(w, r) handler.ServeHTTP(w, r)
}) })
}) })
mux.Group(func(mux chi.Router) {
mux.Use(func(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// allow trailing '/' at end of requests (the openapi gen package doesn't support it)
r.URL.Path = strings.TrimSuffix(r.URL.Path, "/")
handler.ServeHTTP(w, r)
})
})
mux.Mount("/api", apiv1) mux.Mount("/api", apiv1)
})
mux.Mount("/", http.FileServer( mux.Mount("/", http.FileServer(
http.FS(web{}), http.FS(web{}),
)) ))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment