From 32c013f0892bf55740deef56667cfb9c2de83bf9 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Wed, 16 Feb 2022 19:25:27 +0100 Subject: [PATCH] Fix broken __routes debug route --- pkg/api/server/debug.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/api/server/debug.go b/pkg/api/server/debug.go index 37ca5bf53..cb8e71133 100644 --- a/pkg/api/server/debug.go +++ b/pkg/api/server/debug.go @@ -3,8 +3,6 @@ package server import ( "fmt" "net/http" - "reflect" - "runtime" "github.com/cortezaproject/corteza-server/pkg/corredor" "github.com/cortezaproject/corteza-server/pkg/eventbus" @@ -23,8 +21,13 @@ func debugRoutes(r chi.Routes) http.HandlerFunc { if route.SubRoutes != nil && len(route.SubRoutes.Routes()) > 0 { printRoutes(route.SubRoutes, pfix+route.Pattern[:len(route.Pattern)-2]) } else { - for method, fn := range route.Handlers { - fmt.Fprintf(w, "%-8s %-80s -> %s\n", method, pfix+route.Pattern, runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()) + if route.Handlers["*"] != nil { + fmt.Fprintf(w, "%-8s %-80s\n", "*", pfix+route.Pattern) + continue + } + + for method := range route.Handlers { + fmt.Fprintf(w, "%-8s %-80s\n", method, pfix+route.Pattern) } } }