Skip to content

Commit ab4c322

Browse files
algolia-botreneemundieRenee Mundiemorganleroi
committed
fix(clients): InvalidOperationException in C# Fill() due to unsafe dictionary enumeration (generated)
algolia/api-clients-automation#4820 Co-authored-by: Renée Mundie <[email protected]> Co-authored-by: Renee Mundie <[email protected]> Co-authored-by: Morgan Leroi <[email protected]>
1 parent c8c09f2 commit ab4c322

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

algoliasearch/Http/HttpRequestHeadersExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Linq;
23
using System.Net.Http.Headers;
34
using Algolia.Search.Utils;
45

@@ -14,7 +15,7 @@ internal static class HttpRequestHeadersExtensions
1415
/// <returns></returns>
1516
internal static void Fill(this HttpRequestHeaders headers, IDictionary<string, string> dictionary)
1617
{
17-
foreach (var header in dictionary)
18+
foreach (var header in dictionary.ToList())
1819
{
1920
headers.TryAddWithoutValidation(header.Key, header.Value);
2021
}

0 commit comments

Comments
 (0)