Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
53b2a29b
authored
2013-12-19 12:50:47 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
when method is POST then to parse form
1 parent
cb49be78
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
router.go
router.go
View file @
53b2a29
...
...
@@ -575,7 +575,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if
requestPath
==
route
.
pattern
{
runrouter
=
route
.
controllerType
findrouter
=
true
runMethod
=
p
.
getRunMethod
(
r
.
Method
,
context
.
Input
.
Query
(
"_method"
)
,
route
)
runMethod
=
p
.
getRunMethod
(
r
.
Method
,
context
,
route
)
break
}
// pattern /admin url /admin 200 /admin/ 404
...
...
@@ -618,7 +618,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
runrouter
=
route
.
controllerType
findrouter
=
true
context
.
Input
.
Params
=
params
runMethod
=
p
.
getRunMethod
(
r
.
Method
,
context
.
Input
.
Query
(
"_method"
)
,
route
)
runMethod
=
p
.
getRunMethod
(
r
.
Method
,
context
,
route
)
break
}
}
...
...
@@ -788,7 +788,7 @@ func (p *ControllerRegistor) getErrorHandler(errorCode string) func(rw http.Resp
return
handler
}
func
(
p
*
ControllerRegistor
)
getRunMethod
(
method
,
_method
string
,
router
*
controllerInfo
)
string
{
func
(
p
*
ControllerRegistor
)
getRunMethod
(
method
string
,
context
*
beecontext
.
Context
,
router
*
controllerInfo
)
string
{
method
=
strings
.
ToLower
(
method
)
if
router
.
hasMethod
{
if
m
,
ok
:=
router
.
methods
[
method
];
ok
{
...
...
@@ -796,19 +796,19 @@ func (p *ControllerRegistor) getRunMethod(method, _method string, router *contro
}
else
if
m
,
ok
=
router
.
methods
[
"*"
];
ok
{
return
m
}
else
{
if
method
==
"POST"
||
strings
.
ToLower
(
_method
)
==
"put"
{
if
method
==
"POST"
&&
strings
.
ToLower
(
context
.
Input
.
Query
(
"_method"
)
)
==
"put"
{
return
"Put"
}
if
method
==
"POST"
||
strings
.
ToLower
(
_method
)
==
"delete"
{
if
method
==
"POST"
&&
strings
.
ToLower
(
context
.
Input
.
Query
(
"_method"
)
)
==
"delete"
{
return
"Delete"
}
return
strings
.
Title
(
method
)
}
}
else
{
if
method
==
"POST"
||
strings
.
ToLower
(
_method
)
==
"put"
{
if
method
==
"POST"
&&
strings
.
ToLower
(
context
.
Input
.
Query
(
"_method"
)
)
==
"put"
{
return
"Put"
}
if
method
==
"POST"
||
strings
.
ToLower
(
_method
)
==
"delete"
{
if
method
==
"POST"
&&
strings
.
ToLower
(
context
.
Input
.
Query
(
"_method"
)
)
==
"delete"
{
return
"Delete"
}
return
strings
.
Title
(
method
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment