Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
eac09e6f
Commit
eac09e6f
authored
Sep 17, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1349 from ElvizLai/patch-4
Update tree.go
parents
3df0fa46
a2a6ec95
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
tree.go
tree.go
+5
-0
tree_test.go
tree_test.go
+6
-0
No files found.
tree.go
View file @
eac09e6f
...
...
@@ -213,6 +213,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
==
":"
{
t
.
leaves
=
append
(
t
.
leaves
,
&
leafInfo
{
runObject
:
route
,
wildcards
:
wildcards
[
:
i
+
1
]})
}
}
}
else
{
seg
:=
segments
[
0
]
iswild
,
params
,
regexpStr
:=
splitSegment
(
seg
)
...
...
tree_test.go
View file @
eac09e6f
...
...
@@ -26,6 +26,12 @@ var routers []testinfo
func
init
()
{
routers
=
make
([]
testinfo
,
0
)
routers
=
append
(
routers
,
testinfo
{
"/topic/?:auth:int"
,
"/topic"
,
nil
})
routers
=
append
(
routers
,
testinfo
{
"/topic/?:auth:int"
,
"/topic/123"
,
map
[
string
]
string
{
":auth"
:
"123"
}})
routers
=
append
(
routers
,
testinfo
{
"/topic/:id/?:auth"
,
"/topic/1"
,
map
[
string
]
string
{
":id"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/topic/:id/?:auth"
,
"/topic/1/2"
,
map
[
string
]
string
{
":id"
:
"1"
,
":auth"
:
"2"
}})
routers
=
append
(
routers
,
testinfo
{
"/topic/:id/?:auth:int"
,
"/topic/1"
,
map
[
string
]
string
{
":id"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/topic/:id/?:auth:int"
,
"/topic/1/123"
,
map
[
string
]
string
{
":id"
:
"1"
,
":auth"
:
"123"
}})
routers
=
append
(
routers
,
testinfo
{
"/:id"
,
"/123"
,
map
[
string
]
string
{
":id"
:
"123"
}})
routers
=
append
(
routers
,
testinfo
{
"/hello/?:id"
,
"/hello"
,
map
[
string
]
string
{
":id"
:
""
}})
routers
=
append
(
routers
,
testinfo
{
"/"
,
"/"
,
nil
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment