From a6e8665e42dad83ee275d4adc34a6e507bdd11ed Mon Sep 17 00:00:00 2001 From: vinhha96 Date: Mon, 11 May 2020 12:25:49 +0700 Subject: [PATCH] fix(tree): reassign fullpath when register new node which the same current node (#2366) * fix(tree): assign fullpath to current node by fullpath of new node if current node the same new node * test(router-test): reverse the order when register router when test func GetFullPath * chg(tree-test): update test case with register new route in TestRouteContextHoldsFullPath Co-authored-by: vinhha Co-authored-by: Bo-Yi Wu --- routes_test.go | 3 +++ tree.go | 1 + 2 files changed, 4 insertions(+) diff --git a/routes_test.go b/routes_test.go index 360ade62..11ff71a6 100644 --- a/routes_test.go +++ b/routes_test.go @@ -593,6 +593,9 @@ func TestRouteContextHoldsFullPath(t *testing.T) { "/simple-two/one-two", "/project/:name/build/*params", "/project/:name/bui", + "/user/:id/status", + "/user/:id", + "/user/:id/profile", } for _, route := range routes { diff --git a/tree.go b/tree.go index e3aa9190..f528fa3b 100644 --- a/tree.go +++ b/tree.go @@ -240,6 +240,7 @@ walk: panic("handlers are already registered for path '" + fullPath + "'") } n.handlers = handlers + n.fullPath = fullPath return } }