mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 01:30:51 +00:00
fix router bug with more better way
This commit is contained in:
parent
fa1281002e
commit
efc14a1e8d
10
router.go
10
router.go
@ -648,20 +648,16 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
if !findrouter {
|
||||
http_method := ""
|
||||
http_method := r.Method
|
||||
|
||||
if r.Method == "POST" && context.Input.Query("_method") == "PUT" {
|
||||
if http_method == "POST" && context.Input.Query("_method") == "PUT" {
|
||||
http_method = "PUT"
|
||||
}
|
||||
|
||||
if r.Method == "POST" && context.Input.Query("_method") == "DELETE" {
|
||||
if http_method == "POST" && context.Input.Query("_method") == "DELETE" {
|
||||
http_method = "DELETE"
|
||||
}
|
||||
|
||||
if http_method != "PUT" && http_method != "DELETE" {
|
||||
http_method = r.Method
|
||||
}
|
||||
|
||||
if t, ok := p.routers[http_method]; ok {
|
||||
runObject, p := t.Match(urlPath)
|
||||
if r, ok := runObject.(*controllerInfo); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user