mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
Clear DefaultRequestHeaders when adding a new header dictionary (#302)
This commit is contained in:
parent
9859e9d4ae
commit
467984c6f8
@ -166,12 +166,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
private void AddHeaders(Dictionary<string,string> headers)
|
private void AddHeaders(Dictionary<string,string> headers)
|
||||||
{
|
{
|
||||||
|
_client.DefaultRequestHeaders.Clear();
|
||||||
foreach (KeyValuePair<string, string> headerPair in headers)
|
foreach (KeyValuePair<string, string> headerPair in headers)
|
||||||
{
|
{
|
||||||
if (_client.DefaultRequestHeaders.Contains(headerPair.Key))
|
|
||||||
{
|
|
||||||
_client.DefaultRequestHeaders.Remove(headerPair.Key);
|
|
||||||
}
|
|
||||||
_client.DefaultRequestHeaders.TryAddWithoutValidation(headerPair.Key, headerPair.Value);
|
_client.DefaultRequestHeaders.TryAddWithoutValidation(headerPair.Key, headerPair.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user