Skip to content

Commit 467984c

Browse files
flownzuJohnnyCrazy
authored andcommitted
Clear DefaultRequestHeaders when adding a new header dictionary (#302)
1 parent 9859e9d commit 467984c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

SpotifyAPI.Web/SpotifyWebClient.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,9 @@ private static WebHeaderCollection ConvertHeaders(HttpResponseHeaders headers)
166166

167167
private void AddHeaders(Dictionary<string,string> headers)
168168
{
169+
_client.DefaultRequestHeaders.Clear();
169170
foreach (KeyValuePair<string, string> headerPair in headers)
170171
{
171-
if (_client.DefaultRequestHeaders.Contains(headerPair.Key))
172-
{
173-
_client.DefaultRequestHeaders.Remove(headerPair.Key);
174-
}
175172
_client.DefaultRequestHeaders.TryAddWithoutValidation(headerPair.Key, headerPair.Value);
176173
}
177174
}

0 commit comments

Comments
 (0)