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
912abe32
Commit
912abe32
authored
Oct 12, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #1388
parent
4ba50e5d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
router.go
router.go
+1
-1
router_test.go
router_test.go
+12
-0
No files found.
router.go
View file @
912abe32
...
@@ -353,7 +353,7 @@ func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ...
...
@@ -353,7 +353,7 @@ func (p *ControllerRegister) Handler(pattern string, h http.Handler, options ...
route
.
handler
=
h
route
.
handler
=
h
if
len
(
options
)
>
0
{
if
len
(
options
)
>
0
{
if
_
,
ok
:=
options
[
0
]
.
(
bool
);
ok
{
if
_
,
ok
:=
options
[
0
]
.
(
bool
);
ok
{
pattern
=
path
.
Join
(
pattern
,
"?:all"
)
pattern
=
path
.
Join
(
pattern
,
"?:all
(.*)
"
)
}
}
}
}
for
_
,
m
:=
range
HTTPMETHOD
{
for
_
,
m
:=
range
HTTPMETHOD
{
...
...
router_test.go
View file @
912abe32
...
@@ -333,6 +333,18 @@ func TestRouterHandler(t *testing.T) {
...
@@ -333,6 +333,18 @@ func TestRouterHandler(t *testing.T) {
}
}
}
}
func
TestRouterHandlerAll
(
t
*
testing
.
T
)
{
r
,
_
:=
http
.
NewRequest
(
"POST"
,
"/sayhi/a/b/c"
,
nil
)
w
:=
httptest
.
NewRecorder
()
handler
:=
NewControllerRegister
()
handler
.
Handler
(
"/sayhi"
,
http
.
HandlerFunc
(
sayhello
),
true
)
handler
.
ServeHTTP
(
w
,
r
)
if
w
.
Body
.
String
()
!=
"sayhello"
{
t
.
Errorf
(
"TestRouterHandler can't run"
)
}
}
//
//
// Benchmarks NewApp:
// Benchmarks NewApp:
//
//
...
...
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