Skip to content

Commit bf0db02

Browse files
author
Johnny @PC
committed
Removed Header overflow
1 parent 1f359df commit bf0db02

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ public T UploadData<T>(String url, String uploadData, String method = "POST")
345345
{
346346
if (!UseAuth)
347347
throw new Exception("UseAuth required for 'UploadData'");
348-
webclient.Headers.Add("Authorization", TokenType + " " + AccessToken);
349-
webclient.Headers.Add("Content-Type", "application/json");
348+
webclient.Headers.Set("Authorization", TokenType + " " + AccessToken);
349+
webclient.Headers.Set("Content-Type", "application/json");
350350
String response = "";
351351
try
352352
{
@@ -367,7 +367,9 @@ public T DownloadData<T>(String url)
367367
public String DownloadString(String url)
368368
{
369369
if (UseAuth)
370-
webclient.Headers.Add("Authorization", TokenType + " " + AccessToken);
370+
webclient.Headers.Set("Authorization", TokenType + " " + AccessToken);
371+
else if (!UseAuth && webclient.Headers["Authorization"] != null)
372+
webclient.Headers.Remove("Authorization");
371373
String response = "";
372374
try
373375
{

0 commit comments

Comments
 (0)