From 45bb968ea84af9152bed7db896bba272c58ee7c4 Mon Sep 17 00:00:00 2001 From: youngblood <944168348@qq.com> Date: Wed, 8 Aug 2018 18:44:35 +0800 Subject: [PATCH] add fullpath in the end node --- tree.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tree.go b/tree.go index f7187664..bdd4b599 100644 --- a/tree.go +++ b/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) { 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 '*') for i, max := 0, len(path); numParams > 0; i++ { c := path[i]