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
0cad8207
Commit
0cad8207
authored
Aug 01, 2016
by
astaxie
Committed by
GitHub
Aug 01, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2071 from Maxgis/issue_accept_encoding
route variables should not have underline
parents
12503080
6f0a9857
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
tree.go
tree.go
+2
-2
tree_test.go
tree_test.go
+2
-0
No files found.
tree.go
View file @
0cad8207
...
@@ -467,7 +467,7 @@ func splitPath(key string) []string {
...
@@ -467,7 +467,7 @@ func splitPath(key string) []string {
// ":name:string" -> true, [:name], ([\w]+)
// ":name:string" -> true, [:name], ([\w]+)
// ":id([0-9]+)" -> true, [:id], ([0-9]+)
// ":id([0-9]+)" -> true, [:id], ([0-9]+)
// ":id([0-9]+)_:name" -> true, [:id :name], ([0-9]+)_(.+)
// ":id([0-9]+)_:name" -> true, [:id :name], ([0-9]+)_(.+)
// "cms_:id_:page.html" -> true, [:id
_ :page], cms_(.+)
(.+).html
// "cms_:id_:page.html" -> true, [:id
:page], cms_(.+)_
(.+).html
// "cms_:id(.+)_:page.html" -> true, [:id :page], cms_(.+)_(.+).html
// "cms_:id(.+)_:page.html" -> true, [:id :page], cms_(.+)_(.+).html
// "*" -> true, [:splat], ""
// "*" -> true, [:splat], ""
// "*.*" -> true,[. :path :ext], "" . meaning separator
// "*.*" -> true,[. :path :ext], "" . meaning separator
...
@@ -487,7 +487,7 @@ func splitSegment(key string) (bool, []string, string) {
...
@@ -487,7 +487,7 @@ func splitSegment(key string) (bool, []string, string) {
var
expt
[]
rune
var
expt
[]
rune
var
skipnum
int
var
skipnum
int
params
:=
[]
string
{}
params
:=
[]
string
{}
reg
:=
regexp
.
MustCompile
(
`[a-zA-Z0-9
_
]+`
)
reg
:=
regexp
.
MustCompile
(
`[a-zA-Z0-9]+`
)
for
i
,
v
:=
range
key
{
for
i
,
v
:=
range
key
{
if
skipnum
>
0
{
if
skipnum
>
0
{
skipnum
--
skipnum
--
...
...
tree_test.go
View file @
0cad8207
...
@@ -74,6 +74,8 @@ func init() {
...
@@ -74,6 +74,8 @@ func init() {
routers
=
append
(
routers
,
testinfo
{
"/v1/:v(.+)_cms/ttt_:id(.+)_:page(.+).html"
,
"/v1/2_cms/ttt_123_1.html"
,
map
[
string
]
string
{
":v"
:
"2"
,
":id"
:
"123"
,
":page"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/v1/:v(.+)_cms/ttt_:id(.+)_:page(.+).html"
,
"/v1/2_cms/ttt_123_1.html"
,
map
[
string
]
string
{
":v"
:
"2"
,
":id"
:
"123"
,
":page"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/api/projects/:pid/members/?:mid"
,
"/api/projects/1/members"
,
map
[
string
]
string
{
":pid"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/api/projects/:pid/members/?:mid"
,
"/api/projects/1/members"
,
map
[
string
]
string
{
":pid"
:
"1"
}})
routers
=
append
(
routers
,
testinfo
{
"/api/projects/:pid/members/?:mid"
,
"/api/projects/1/members/2"
,
map
[
string
]
string
{
":pid"
:
"1"
,
":mid"
:
"2"
}})
routers
=
append
(
routers
,
testinfo
{
"/api/projects/:pid/members/?:mid"
,
"/api/projects/1/members/2"
,
map
[
string
]
string
{
":pid"
:
"1"
,
":mid"
:
"2"
}})
routers
=
append
(
routers
,
testinfo
{
"/view/:id_:page"
,
"/view/12_33"
,
map
[
string
]
string
{
":id"
:
"12"
,
":page"
:
"33"
}})
routers
=
append
(
routers
,
testinfo
{
"/view/:id_:page.html"
,
"/view/12_33.html"
,
map
[
string
]
string
{
":id"
:
"12"
,
":page"
:
"33"
}})
}
}
func
TestTreeRouters
(
t
*
testing
.
T
)
{
func
TestTreeRouters
(
t
*
testing
.
T
)
{
...
...
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