From bf0db02e91e2f26338abe354bae4e04e20cacc1b Mon Sep 17 00:00:00 2001 From: "Johnny @PC" Date: Sat, 21 Feb 2015 18:38:47 +0100 Subject: [PATCH] Removed Header overflow --- SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs b/SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs index c0d7f43f..e7cf1cd8 100644 --- a/SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs +++ b/SpotifyAPI/SpotifyWebAPI/SpotifyWebAPIClass.cs @@ -345,8 +345,8 @@ namespace SpotifyAPI.SpotifyWebAPI { if (!UseAuth) throw new Exception("UseAuth required for 'UploadData'"); - webclient.Headers.Add("Authorization", TokenType + " " + AccessToken); - webclient.Headers.Add("Content-Type", "application/json"); + webclient.Headers.Set("Authorization", TokenType + " " + AccessToken); + webclient.Headers.Set("Content-Type", "application/json"); String response = ""; try { @@ -367,7 +367,9 @@ namespace SpotifyAPI.SpotifyWebAPI public String DownloadString(String url) { if (UseAuth) - webclient.Headers.Add("Authorization", TokenType + " " + AccessToken); + webclient.Headers.Set("Authorization", TokenType + " " + AccessToken); + else if (!UseAuth && webclient.Headers["Authorization"] != null) + webclient.Headers.Remove("Authorization"); String response = ""; try {