mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
pkg/web: remove dependency injection (#49123)
* pkg/web: store http.Handler internally * pkg/web: remove injection Removes any injection code from pkg/web. It already was no longer functional, as we already only injected into `http.Handler`, meaning we only inject ctx.Req and ctx.Resp. Any other types (*Context, *ReqContext) were already accessed using the http.Request.Context.Value() method. * *: remove type mappings Removes any call to the previously removed TypeMapper, as those were non-functional already. * pkg/web: remove Context.Invoke was no longer used outside of pkg/web and also no longer functional
This commit is contained in:
@@ -95,9 +95,8 @@ func (h *ContextHandler) Middleware(mContext *web.Context) {
|
||||
Logger: log.New("context"),
|
||||
}
|
||||
|
||||
// Inject ReqContext into a request context and replace the request instance in the macaron context
|
||||
// Inject ReqContext into http.Request.Context
|
||||
mContext.Req = mContext.Req.WithContext(ctxkey.Set(mContext.Req.Context(), reqContext))
|
||||
mContext.Map(mContext.Req)
|
||||
|
||||
traceID := tracing.TraceIDFromContext(mContext.Req.Context(), false)
|
||||
if traceID != "" {
|
||||
@@ -153,8 +152,6 @@ func (h *ContextHandler) Middleware(mContext *web.Context) {
|
||||
{Num: reqContext.UserId}},
|
||||
)
|
||||
|
||||
mContext.Map(reqContext)
|
||||
|
||||
// update last seen every 5min
|
||||
if reqContext.ShouldUpdateLastSeenAt() {
|
||||
reqContext.Logger.Debug("Updating last user_seen_at", "user_id", reqContext.UserId)
|
||||
|
||||
Reference in New Issue
Block a user