mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 10:02:10 +08:00
add fullpath in the end node
This commit is contained in:
parent
2fc9b15c7a
commit
45bb968ea8
5
tree.go
5
tree.go
@ -248,6 +248,11 @@ func (n *node) addRoute(path string, handlers HandlersChain) {
|
|||||||
func (n *node) insertChild(numParams uint8, path string, fullPath string, handlers HandlersChain) {
|
func (n *node) insertChild(numParams uint8, path string, fullPath string, handlers HandlersChain) {
|
||||||
var offset int // already handled bytes of the path
|
var offset int // already handled bytes of the path
|
||||||
|
|
||||||
|
// add the prefix of the route
|
||||||
|
if fullPath[0] != '/' {
|
||||||
|
fullPath = "/" + fullPath
|
||||||
|
}
|
||||||
|
|
||||||
// find prefix until first wildcard (beginning with ':' or '*')
|
// find prefix until first wildcard (beginning with ':' or '*')
|
||||||
for i, max := 0, len(path); numParams > 0; i++ {
|
for i, max := 0, len(path); numParams > 0; i++ {
|
||||||
c := path[i]
|
c := path[i]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user