@@ -166,14 +166,11 @@ private IEnumerable<Task<HttpContext>> ProcessRouteWithComplexAggregation(Aggreg
166166 JToken jObject , HttpContext httpContext , DownstreamRoute downstreamRoute )
167167 {
168168 var processing = new List < Task < HttpContext > > ( ) ;
169- var values = jObject . SelectTokens ( matchAdvancedAgg . JsonPath ) . Select ( s => s . ToString ( ) ) . Distinct ( )
170- . ToList ( ) ;
169+ var values = jObject . SelectTokens ( matchAdvancedAgg . JsonPath ) . Select ( s => s . ToString ( ) ) . Distinct ( ) ;
171170 foreach ( var value in values )
172171 {
173- var tPnv = new List < PlaceholderNameAndValue > ( httpContext . Items . TemplatePlaceholderNameAndValues ( ) )
174- {
175- new ( '{' + matchAdvancedAgg . Parameter + '}' , value ) ,
176- } ;
172+ var tPnv = httpContext . Items . TemplatePlaceholderNameAndValues ( ) ;
173+ tPnv . Add ( new PlaceholderNameAndValue ( '{' + matchAdvancedAgg . Parameter + '}' , value ) ) ;
177174 processing . Add ( ProcessRouteAsync ( httpContext , downstreamRoute , tPnv ) ) ;
178175 }
179176
@@ -258,16 +255,6 @@ protected virtual Task MapAsync(HttpContext httpContext, Route route, List<HttpC
258255 return Task . CompletedTask ;
259256 }
260257
261- // ensure each context retains its correct aggregate key for proper response mapping
262- if ( route . DownstreamRouteConfig != null && route . DownstreamRouteConfig . Count > 0 )
263- {
264- for ( int i = 0 ; i < contexts . Count && i < route . DownstreamRouteConfig . Count ; i ++ )
265- {
266- var key = route . DownstreamRouteConfig [ i ] . RouteKey ;
267- contexts [ i ] . Items [ "CurrentAggregateRouteKey" ] = key ;
268- }
269- }
270-
271258 var aggregator = _factory . Get ( route ) ;
272259 return aggregator . Aggregate ( route , httpContext , contexts ) ;
273260 }
0 commit comments