mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 06:41:29 +00:00
Merge pull request #867 from WithGJR/develop
fix router bug: when the request is PUT or DELETE, router can't find the...
This commit is contained in:
commit
24489df63d
12
router.go
12
router.go
@ -648,7 +648,17 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
if !findrouter {
|
||||
if t, ok := p.routers[r.Method]; ok {
|
||||
http_method := r.Method
|
||||
|
||||
if http_method == "POST" && context.Input.Query("_method") == "PUT" {
|
||||
http_method = "PUT"
|
||||
}
|
||||
|
||||
if http_method == "POST" && context.Input.Query("_method") == "DELETE" {
|
||||
http_method = "DELETE"
|
||||
}
|
||||
|
||||
if t, ok := p.routers[http_method]; ok {
|
||||
runObject, p := t.Match(urlPath)
|
||||
if r, ok := runObject.(*controllerInfo); ok {
|
||||
routerInfo = r
|
||||
|
Loading…
Reference in New Issue
Block a user