func HTTPMiddleware(cfgManager config.Manager, targetKey string) func(next http.Handler) http.Handler {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
			// Get request context
			ctx := r.Context()

			// Create response handler object
			rh := NewHandler(r, rw, cfgManager, targetKey)

			// Inject in context
			ctx = SetResponseHandlerInContext(ctx, rh)
			// Inject in request
			r = r.WithContext(ctx)

			// Next
			h.ServeHTTP(rw, r)
		})
	}
}
// HTTPMiddleware will add a new response handler on each request.
HTTPMiddleware will add a new response handler on each request.
// HTTPMiddleware will add a new response handler on each request .
func HTTPMiddleware(cfgManager config.Manager, targetKey string) func(next http.Handler) http.Handler {
	return func(h http.Handler) http.Handler {
		return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
			ctx := r.Context()
			rh := NewHandler(r, rw, cfgManager, targetKey)
			ctx = SetResponseHandlerInContext(ctx, rh)
			r = r.WithContext(ctx)
			h.ServeHTTP(rw, r)
		})
	}
}
func HTTPMiddleware ( cfgManager config . Manager , targetKey string ) func ( next http . Handler ) http . Handler { return func ( h http . Handler ) http . Handler { return http . HandlerFunc ( func ( rw http . ResponseWriter , r * http . Request ) { ctx := r . Context ( ) rh := NewHandler ( r , rw , cfgManager , targetKey ) ctx = SetResponseHandlerInContext ( ctx , rh ) r = r . WithContext ( ctx ) h . ServeHTTP ( rw , r ) } ) } }
HTTPMiddleware will add a new response handler on each request.
HTTPMiddleware will add a new response handler on each request .
// Get request context // Create response handler object // Inject in context // Inject in request // Next