Fix broken __routes debug route
This commit is contained in:
@@ -3,8 +3,6 @@ package server
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/cortezaproject/corteza-server/pkg/corredor"
|
"github.com/cortezaproject/corteza-server/pkg/corredor"
|
||||||
"github.com/cortezaproject/corteza-server/pkg/eventbus"
|
"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 {
|
if route.SubRoutes != nil && len(route.SubRoutes.Routes()) > 0 {
|
||||||
printRoutes(route.SubRoutes, pfix+route.Pattern[:len(route.Pattern)-2])
|
printRoutes(route.SubRoutes, pfix+route.Pattern[:len(route.Pattern)-2])
|
||||||
} else {
|
} else {
|
||||||
for method, fn := range route.Handlers {
|
if route.Handlers["*"] != nil {
|
||||||
fmt.Fprintf(w, "%-8s %-80s -> %s\n", method, pfix+route.Pattern, runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user