package middlewares import ( "context" "net/http" ) func InjectContextValuesBuilder(values map[ContextKey]any) func(http.Handler) http.Handler { return func(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() for k, v := range values { ctx = context.WithValue(ctx, k, v) } h.ServeHTTP(w, r.WithContext(ctx)) }) } }