Skip to content

Commit 0bdb7f6

Browse files
committed
prevent double Authorization header values
1 parent 8be677c commit 0bdb7f6

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)