From 683e6856efdec31a1ac81a1dce20d82bd955c2bc Mon Sep 17 00:00:00 2001 From: Maxim Sukharev Date: Fri, 28 Oct 2016 10:44:16 +0700 Subject: [PATCH] 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. --- router.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/router.go b/router.go index 97b0edba..456c3221 100644 --- a/router.go +++ b/router.go @@ -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) - } + //store router pattern into context + context.Input.SetData("RouterPattern", routerInfo.pattern) if routerInfo.routerType == routerTypeRESTFul { if _, ok := routerInfo.methods[r.Method]; ok { isRunnable = true