Expose HandlerFunc in RouteInfos

This commit is contained in:
Thomas Schaffer 2018-03-07 09:09:58 +01:00
parent 5d3f30cfc8
commit 09c308b555

5
gin.go
View File

@ -41,6 +41,7 @@ type RouteInfo struct {
Method string
Path string
Handler string
HandlerFunc HandlerFunc
}
type RoutesInfo []RouteInfo
@ -264,10 +265,12 @@ func (engine *Engine) Routes() (routes RoutesInfo) {
func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
path += root.path
if len(root.handlers) > 0 {
handlerFunc := root.handlers.Last()
routes = append(routes, RouteInfo{
Method: method,
Path: path,
Handler: nameOfFunction(root.handlers.Last()),
Handler: nameOfFunction(handlerFunc),
HandlerFunc: handlerFunc,
})
}
for _, child := range root.children {