From 3c12a588d89fb80e2f99a276cec940944641234b Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 24 Apr 2021 11:40:40 +1000 Subject: [PATCH 1/2] fix multi enumeration bug --- src/HttpClientInterception/BundleExtensions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/HttpClientInterception/BundleExtensions.cs b/src/HttpClientInterception/BundleExtensions.cs index 9c343774..1be81879 100644 --- a/src/HttpClientInterception/BundleExtensions.cs +++ b/src/HttpClientInterception/BundleExtensions.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; using JustEat.HttpClientInterception.Bundles; namespace JustEat.HttpClientInterception @@ -79,6 +80,7 @@ public static HttpClientInterceptorOptions RegisterBundle( if (bundle.Items != null) { + var templateValueLists = templateValues.ToList(); foreach (var item in bundle.Items) { if (item == null || item.Skip) @@ -86,7 +88,7 @@ public static HttpClientInterceptorOptions RegisterBundle( continue; } - builders.Add(BundleItemConverter.FromItem(item, templateValues)); + builders.Add(BundleItemConverter.FromItem(item, templateValueLists)); } } From 98203d02202999f080931d642f14dfca07cd45ec Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Mon, 26 Apr 2021 13:07:00 +0100 Subject: [PATCH 2/2] Change variable name It's a list of templates, not multiple lists of a template. --- src/HttpClientInterception/BundleExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/HttpClientInterception/BundleExtensions.cs b/src/HttpClientInterception/BundleExtensions.cs index 1be81879..c0a34ed2 100644 --- a/src/HttpClientInterception/BundleExtensions.cs +++ b/src/HttpClientInterception/BundleExtensions.cs @@ -80,7 +80,8 @@ public static HttpClientInterceptorOptions RegisterBundle( if (bundle.Items != null) { - var templateValueLists = templateValues.ToList(); + var templateValuesList = templateValues.ToList(); + foreach (var item in bundle.Items) { if (item == null || item.Skip) @@ -88,7 +89,7 @@ public static HttpClientInterceptorOptions RegisterBundle( continue; } - builders.Add(BundleItemConverter.FromItem(item, templateValueLists)); + builders.Add(BundleItemConverter.FromItem(item, templateValuesList)); } }