1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 16:00:59 +00:00

Add RouterPattern to context.Input

Right now beego adds this param only in dev mode, but I noticed that it's very useful to have in prod environment to.
My current use case - filter that sends logs in newrelic. Pattern there will help a lot to generate correct transaction name.
This commit is contained in:
Maxim Sukharev 2016-10-28 10:44:16 +07:00 committed by GitHub
parent 2d87d4feaf
commit 683e6856ef

View File

@ -712,10 +712,8 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
}
if routerInfo != nil {
if BConfig.RunMode == DEV {
//store router pattern into context
context.Input.SetData("RouterPattern", routerInfo.pattern)
}
if routerInfo.routerType == routerTypeRESTFul {
if _, ok := routerInfo.methods[r.Method]; ok {
isRunnable = true