Commit 40cb8e0c authored by JessonChan's avatar JessonChan

use reflect to ensure all methods been except

parent 0ac690d2
......@@ -63,13 +63,14 @@ var (
"CONNECT": "CONNECT",
}
// these beego.Controller's methods shouldn't reflect to AutoRouter
exceptMethod = []string{"Init", "Prepare", "Finish", "Render", "RenderString",
"RenderBytes", "Redirect", "Abort", "StopRun", "UrlFor", "ServeJson", "ServeJsonp",
"ServeXml", "Input", "ParseForm", "GetString", "GetStrings", "GetInt", "GetBool",
"GetFloat", "GetFile", "SaveToFile", "StartSession", "SetSession", "GetSession",
"DelSession", "SessionRegenerateID", "DestroySession", "IsAjax", "GetSecureCookie",
"SetSecureCookie", "XsrfToken", "CheckXsrfCookie", "XsrfFormHtml",
"GetControllerAndAction"}
exceptMethod = func() []string {
methods := []string{}
rv := reflect.TypeOf(&Controller{})
for i := 0; i < rv.NumMethod(); i++ {
methods = append(methods, rv.Method(i).Name)
}
return methods
}()
urlPlaceholder = "{{placeholder}}"
// DefaultAccessLogFilter will skip the accesslog if return true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment