From c38bc3cc062887a153532308853e25415431edf2 Mon Sep 17 00:00:00 2001 From: vinhha Date: Sat, 9 May 2020 14:07:20 +0700 Subject: [PATCH 1/3] fix(tree): assign fullpath to current node by fullpath of new node if current node the same new node --- tree.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tree.go b/tree.go index b687ec43d5..8b2ce03d40 100644 --- a/tree.go +++ b/tree.go @@ -260,6 +260,7 @@ walk: panic("handlers are already registered for path '" + fullPath + "'") } n.handlers = handlers + n.fullPath = fullPath return } } From c2e0974b3d856ca1ccacf6572b372102f2356246 Mon Sep 17 00:00:00 2001 From: vinhha Date: Sat, 9 May 2020 14:24:42 +0700 Subject: [PATCH 2/3] test(router-test): reverse the order when register router when test func GetFullPath --- routes_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes_test.go b/routes_test.go index 360ade6215..f19035e8aa 100644 --- a/routes_test.go +++ b/routes_test.go @@ -585,6 +585,7 @@ func TestRouteContextHoldsFullPath(t *testing.T) { // Test routes routes := []string{ "/simple", + "/project/:name/bui", "/project/:name", "/", "/news/home", @@ -592,7 +593,6 @@ func TestRouteContextHoldsFullPath(t *testing.T) { "/simple-two/one", "/simple-two/one-two", "/project/:name/build/*params", - "/project/:name/bui", } for _, route := range routes { From f85416792e9263fff770fdb1f2695338edb14065 Mon Sep 17 00:00:00 2001 From: vinhha Date: Mon, 11 May 2020 11:52:33 +0700 Subject: [PATCH 3/3] chg(tree-test): update test case with register new route in TestRouteContextHoldsFullPath --- routes_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routes_test.go b/routes_test.go index f19035e8aa..11ff71a6a6 100644 --- a/routes_test.go +++ b/routes_test.go @@ -585,7 +585,6 @@ func TestRouteContextHoldsFullPath(t *testing.T) { // Test routes routes := []string{ "/simple", - "/project/:name/bui", "/project/:name", "/", "/news/home", @@ -593,6 +592,10 @@ func TestRouteContextHoldsFullPath(t *testing.T) { "/simple-two/one", "/simple-two/one-two", "/project/:name/build/*params", + "/project/:name/bui", + "/user/:id/status", + "/user/:id", + "/user/:id/profile", } for _, route := range routes {