diff --git a/tree.go b/tree.go index bdd4b599..2324ba48 100644 --- a/tree.go +++ b/tree.go @@ -155,6 +155,7 @@ func (n *node) addRoute(path string, handlers HandlersChain) { children: n.children, handlers: n.handlers, priority: n.priority - 1, + fullPath: n.fullPath, } // Update maxParams (max of all children) @@ -236,6 +237,7 @@ func (n *node) addRoute(path string, handlers HandlersChain) { panic("handlers are already registered for path '" + fullPath + "'") } n.handlers = handlers + n.fullPath = fullPath } return } diff --git a/tree_test.go b/tree_test.go index 4ceb5682..de1148a8 100644 --- a/tree_test.go +++ b/tree_test.go @@ -33,7 +33,7 @@ func checkRequests(t *testing.T, tree *node, requests testRequests, unescapes .. } for _, request := range requests { - handler, ps, _, _ := tree.getValue(request.path, nil, unescape) + handler, ps, rp, _ := tree.getValue(request.path, nil, unescape) if handler == nil { if !request.nilHandler { @@ -46,6 +46,9 @@ func checkRequests(t *testing.T, tree *node, requests testRequests, unescapes .. if fakeHandlerValue != request.route { t.Errorf("handle mismatch for route '%s': Wrong handle (%s != %s)", request.path, fakeHandlerValue, request.route) } + if rp != request.route { + t.Errorf("full path mismatch, expected: \"%s\" got: \"%s\"", request.route, rp) + } } if !reflect.DeepEqual(ps, request.ps) {