Update tree.go

fix routers for:
```
/topic/:id/?:auth
/topic/:id/?:auth:int
```
This commit is contained in:
Yongzheng Lai 2015-09-06 12:01:50 +08:00
parent a89f14d80d
commit 5ad999a3d1
1 changed files with 5 additions and 0 deletions

View File

@ -208,6 +208,11 @@ func (t *Tree) addseg(segments []string, route interface{}, wildcards []string,
} else {
t.leaves = append(t.leaves, &leafInfo{runObject: route, wildcards: wildcards})
}
for i, v := range wildcards {
if v==":" && i!=0{
t.leaves = append(t.leaves, &leafInfo{runObject: route, wildcards: wildcards[:i+1]})
}
}
} else {
seg := segments[0]
iswild, params, regexpStr := splitSegment(seg)