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
c4d8e4a2
Commit
c4d8e4a2
authored
Nov 04, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #759
parent
9d4ec508
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
router.go
router.go
+8
-8
No files found.
router.go
View file @
c4d8e4a2
...
@@ -452,8 +452,8 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
...
@@ -452,8 +452,8 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
}
}
controllName
:=
strings
.
Join
(
paths
[
:
len
(
paths
)
-
1
],
"/"
)
controllName
:=
strings
.
Join
(
paths
[
:
len
(
paths
)
-
1
],
"/"
)
methodName
:=
paths
[
len
(
paths
)
-
1
]
methodName
:=
paths
[
len
(
paths
)
-
1
]
for
_
,
t
:=
range
p
.
routers
{
for
m
,
t
:=
range
p
.
routers
{
ok
,
url
:=
p
.
geturl
(
t
,
"/"
,
controllName
,
methodName
,
params
)
ok
,
url
:=
p
.
geturl
(
t
,
"/"
,
controllName
,
methodName
,
params
,
m
)
if
ok
{
if
ok
{
return
url
return
url
}
}
...
@@ -461,17 +461,17 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
...
@@ -461,17 +461,17 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
return
""
return
""
}
}
func
(
p
*
ControllerRegistor
)
geturl
(
t
*
Tree
,
url
,
controllName
,
methodName
string
,
params
map
[
string
]
string
)
(
bool
,
string
)
{
func
(
p
*
ControllerRegistor
)
geturl
(
t
*
Tree
,
url
,
controllName
,
methodName
string
,
params
map
[
string
]
string
,
httpMethod
string
)
(
bool
,
string
)
{
for
k
,
subtree
:=
range
t
.
fixrouters
{
for
k
,
subtree
:=
range
t
.
fixrouters
{
u
:=
path
.
Join
(
url
,
k
)
u
:=
path
.
Join
(
url
,
k
)
ok
,
u
:=
p
.
geturl
(
subtree
,
u
,
controllName
,
methodName
,
params
)
ok
,
u
:=
p
.
geturl
(
subtree
,
u
,
controllName
,
methodName
,
params
,
httpMethod
)
if
ok
{
if
ok
{
return
ok
,
u
return
ok
,
u
}
}
}
}
if
t
.
wildcard
!=
nil
{
if
t
.
wildcard
!=
nil
{
u
rl
=
path
.
Join
(
url
,
url_placeholder
)
u
:
=
path
.
Join
(
url
,
url_placeholder
)
ok
,
u
:=
p
.
geturl
(
t
.
wildcard
,
u
rl
,
controllName
,
methodName
,
params
)
ok
,
u
:=
p
.
geturl
(
t
.
wildcard
,
u
,
controllName
,
methodName
,
params
,
httpMethod
)
if
ok
{
if
ok
{
return
ok
,
u
return
ok
,
u
}
}
...
@@ -491,8 +491,8 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin
...
@@ -491,8 +491,8 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin
}
}
}
}
if
!
find
{
if
!
find
{
for
_
,
md
:=
range
c
.
methods
{
for
m
,
md
:=
range
c
.
methods
{
if
md
==
methodName
{
if
(
m
==
"*"
||
m
==
httpMethod
)
&&
md
==
methodName
{
find
=
true
find
=
true
}
}
}
}
...
...
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