1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 02:00:50 +00:00

clearly the router, If user set the third params, will not follow the RESTful method

This commit is contained in:
astaxie 2013-12-24 15:27:00 +08:00
parent fc19f8f183
commit 0b659961ba

View File

@ -566,10 +566,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
for _, route := range p.fixrouters {
n := len(requestPath)
if requestPath == route.pattern {
runrouter = route.controllerType
findrouter = true
runMethod = p.getRunMethod(r.Method, context, route)
break
if runMethod != "" {
runrouter = route.controllerType
findrouter = true
break
}
}
// pattern /admin url /admin 200 /admin/ 404
// pattern /admin/ url /admin 301 /admin/ 200
@ -608,11 +610,13 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
//reassemble query params and add to RawQuery
r.URL.RawQuery = url.Values(values).Encode()
}
runrouter = route.controllerType
findrouter = true
context.Input.Params = params
runMethod = p.getRunMethod(r.Method, context, route)
break
if runMethod != "" {
runrouter = route.controllerType
context.Input.Params = params
findrouter = true
break
}
}
}
@ -798,7 +802,7 @@ func (p *ControllerRegistor) getRunMethod(method string, context *beecontext.Con
} else if m, ok = router.methods["*"]; ok {
return m
} else {
return strings.Title(method)
return ""
}
} else {
return strings.Title(method)