mirror of
https://github.com/astaxie/beego.git
synced 2025-06-20 07:20:39 +00:00
admin filter finish to all router include static file
so if your web is need auth or release the resoure you can writer the finish filter
This commit is contained in:
12
router.go
12
router.go
@ -844,6 +844,18 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
Admin:
|
||||
if p.enableFilter {
|
||||
if l, ok := p.filters["Finish"]; ok {
|
||||
for _, filterR := range l {
|
||||
if filterR.ValidRouter(r.URL.Path) {
|
||||
filterR.filterFunc(context)
|
||||
if w.started {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//admin module record QPS
|
||||
if EnableAdmin {
|
||||
timeend := time.Since(starttime)
|
||||
|
Reference in New Issue
Block a user