mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 12:12:12 +08:00
feat(route): add handlers chain in RouteInfo
This commit is contained in:
parent
5dd833f1f2
commit
dc281f790c
3
gin.go
3
gin.go
@ -12,6 +12,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ type RouteInfo struct {
|
|||||||
Path string
|
Path string
|
||||||
Handler string
|
Handler string
|
||||||
HandlerFunc HandlerFunc
|
HandlerFunc HandlerFunc
|
||||||
|
HandlersChain HandlersChain
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoutesInfo defines a RouteInfo slice.
|
// RoutesInfo defines a RouteInfo slice.
|
||||||
@ -393,6 +395,7 @@ func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo {
|
|||||||
Path: path,
|
Path: path,
|
||||||
Handler: nameOfFunction(handlerFunc),
|
Handler: nameOfFunction(handlerFunc),
|
||||||
HandlerFunc: handlerFunc,
|
HandlerFunc: handlerFunc,
|
||||||
|
HandlersChain: slices.Clone(root.handlers),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, child := range root.children {
|
for _, child := range root.children {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user