mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:50:56 +00:00
use reflect to ensure all methods been except
This commit is contained in:
parent
0ac690d2c8
commit
40cb8e0cf1
15
router.go
15
router.go
@ -63,13 +63,14 @@ var (
|
|||||||
"CONNECT": "CONNECT",
|
"CONNECT": "CONNECT",
|
||||||
}
|
}
|
||||||
// these beego.Controller's methods shouldn't reflect to AutoRouter
|
// these beego.Controller's methods shouldn't reflect to AutoRouter
|
||||||
exceptMethod = []string{"Init", "Prepare", "Finish", "Render", "RenderString",
|
exceptMethod = func() []string {
|
||||||
"RenderBytes", "Redirect", "Abort", "StopRun", "UrlFor", "ServeJson", "ServeJsonp",
|
methods := []string{}
|
||||||
"ServeXml", "Input", "ParseForm", "GetString", "GetStrings", "GetInt", "GetBool",
|
rv := reflect.TypeOf(&Controller{})
|
||||||
"GetFloat", "GetFile", "SaveToFile", "StartSession", "SetSession", "GetSession",
|
for i := 0; i < rv.NumMethod(); i++ {
|
||||||
"DelSession", "SessionRegenerateID", "DestroySession", "IsAjax", "GetSecureCookie",
|
methods = append(methods, rv.Method(i).Name)
|
||||||
"SetSecureCookie", "XsrfToken", "CheckXsrfCookie", "XsrfFormHtml",
|
}
|
||||||
"GetControllerAndAction"}
|
return methods
|
||||||
|
}()
|
||||||
|
|
||||||
urlPlaceholder = "{{placeholder}}"
|
urlPlaceholder = "{{placeholder}}"
|
||||||
// DefaultAccessLogFilter will skip the accesslog if return true
|
// DefaultAccessLogFilter will skip the accesslog if return true
|
||||||
|
Loading…
Reference in New Issue
Block a user