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
797bd982
Commit
797bd982
authored
Sep 22, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #210
parent
4a3d32dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
router.go
router.go
+7
-5
No files found.
router.go
View file @
797bd982
...
...
@@ -444,18 +444,15 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
vc
:=
reflect
.
New
(
runrouter
.
controllerType
)
//call the controller init function
init
:=
vc
.
MethodByName
(
"Init"
)
method
:=
vc
.
MethodByName
(
"Init"
)
in
:=
make
([]
reflect
.
Value
,
2
)
in
[
0
]
=
reflect
.
ValueOf
(
context
)
in
[
1
]
=
reflect
.
ValueOf
(
runrouter
.
controllerType
.
Name
())
init
.
Call
(
in
)
//call prepare function
in
=
make
([]
reflect
.
Value
,
0
)
method
:=
vc
.
MethodByName
(
"Prepare"
)
method
.
Call
(
in
)
//if XSRF is Enable then check cookie where there has any cookie in the request's cookie _csrf
if
EnableXSRF
{
in
=
make
([]
reflect
.
Value
,
0
)
method
=
vc
.
MethodByName
(
"XsrfToken"
)
method
.
Call
(
in
)
if
r
.
Method
==
"POST"
||
r
.
Method
==
"DELETE"
||
r
.
Method
==
"PUT"
||
...
...
@@ -465,6 +462,11 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
}
}
//call prepare function
in
=
make
([]
reflect
.
Value
,
0
)
method
=
vc
.
MethodByName
(
"Prepare"
)
method
.
Call
(
in
)
//if response has written,yes don't run next
if
!
w
.
started
{
if
r
.
Method
==
"GET"
{
...
...
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