Merge pull request #172 from fnproject/export_app_name

Add appname and route path to context
This commit is contained in:
James Jeffrey
2017-07-28 11:33:47 -07:00
committed by GitHub

View File

@@ -208,10 +208,12 @@ func loggerWrap(c *gin.Context) {
if appName := c.Param(api.CApp); appName != "" {
c.Set(api.AppName, appName)
c.Request = c.Request.WithContext(context.WithValue(c.Request.Context(), api.AppName, appName))
}
if routePath := c.Param(api.CRoute); routePath != "" {
c.Set(api.Path, routePath)
c.Request = c.Request.WithContext(context.WithValue(c.Request.Context(), api.Path, routePath))
}
c.Request = c.Request.WithContext(ctx)