mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 14:00:54 +00:00
Merge pull request #4007 from flycash/fix3949
Store RouterPattern before filter execute
This commit is contained in:
commit
0056b92d0b
11
router.go
11
router.go
@ -750,19 +750,22 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//execute middleware filters
|
if routerInfo != nil {
|
||||||
|
// store router pattern into context
|
||||||
|
context.Input.SetData("RouterPattern", routerInfo.pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
// execute middleware filters
|
||||||
if len(p.filters[BeforeExec]) > 0 && p.execFilter(context, urlPath, BeforeExec) {
|
if len(p.filters[BeforeExec]) > 0 && p.execFilter(context, urlPath, BeforeExec) {
|
||||||
goto Admin
|
goto Admin
|
||||||
}
|
}
|
||||||
|
|
||||||
//check policies
|
// check policies
|
||||||
if p.execPolicy(context, urlPath) {
|
if p.execPolicy(context, urlPath) {
|
||||||
goto Admin
|
goto Admin
|
||||||
}
|
}
|
||||||
|
|
||||||
if routerInfo != nil {
|
if routerInfo != nil {
|
||||||
//store router pattern into context
|
|
||||||
context.Input.SetData("RouterPattern", routerInfo.pattern)
|
|
||||||
if routerInfo.routerType == routerTypeRESTFul {
|
if routerInfo.routerType == routerTypeRESTFul {
|
||||||
if _, ok := routerInfo.methods[r.Method]; ok {
|
if _, ok := routerInfo.methods[r.Method]; ok {
|
||||||
isRunnable = true
|
isRunnable = true
|
||||||
|
Loading…
Reference in New Issue
Block a user