Skip to content

Commit 77a8e8b

Browse files
committed
Merge pull request #643 from altima/master
prevent double Authorization header values in WNS connection
2 parents d9d1aaa + 0bdb7f6 commit 77a8e8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

PushSharp.Windows/WnsConnection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public async Task Send (WnsNotification notification)
6363
var http = new HttpClient ();
6464

6565
http.DefaultRequestHeaders.TryAddWithoutValidation ("X-WNS-Type", string.Format ("wns/{0}", notification.Type.ToString ().ToLower ()));
66-
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + accessToken);
66+
if(!http.DefaultRequestHeaders.Contains("Authorization")) //prevent double values
67+
http.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + accessToken);
6768

6869
if (notification.RequestForStatus.HasValue)
6970
http.DefaultRequestHeaders.TryAddWithoutValidation ("X-WNS-RequestForStatus", notification.RequestForStatus.Value.ToString().ToLower());

0 commit comments

Comments
 (0)