MCPcopy
hub / github.com/gin-gonic/gin / Routes

Method Routes

gin.go:390–395  ·  view source on GitHub ↗

Routes returns a slice of registered routes, including some useful information, such as: the http method, path, and the handler name.

()

Source from the content-addressed store, hash-verified

388// Routes returns a slice of registered routes, including some useful information, such as:
389// the http method, path, and the handler name.
390func (engine *Engine) Routes() (routes RoutesInfo) {
391 for _, tree := range engine.trees {
392 routes = iterate("", tree.method, routes, tree.root)
393 }
394 return routes
395}
396
397func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
398 path += root.path

Callers 4

TestListOfRoutesFunction · 0.80
TestNewOptionFuncFunction · 0.80
TestWithOptionFuncFunction · 0.80
RoutesFunction · 0.80

Calls 1

iterateFunction · 0.85

Tested by 3

TestListOfRoutesFunction · 0.64
TestNewOptionFuncFunction · 0.64
TestWithOptionFuncFunction · 0.64