File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 99using System . Linq ;
1010using System . Net ;
1111using System . Text ;
12+ using System . IO ;
1213
1314namespace PushSharp . Windows
1415{
@@ -89,11 +90,17 @@ public async Task Send (WnsNotification notification)
8990 http . DefaultRequestHeaders . Add ( "X-WNS-Cache-Policy" , winTileBadge . CachePolicy == WnsNotificationCachePolicyType . Cache ? "cache" : "no-cache" ) ;
9091 }
9192
92- var content = new StringContent (
93- notification . Payload . ToString ( ) , // Get XML payload
94- System . Text . Encoding . UTF8 ,
95- notification . Type == WnsNotificationType . Raw ? "application/octet-stream" : "text/xml" ) ;
96-
93+ HttpContent content = null ;
94+
95+ if ( notification . Type == WnsNotificationType . Raw ) {
96+ content = new StreamContent ( new MemoryStream ( Encoding . UTF8 . GetBytes ( notification . Payload . ToString ( ) ) ) ) ;
97+ } else {
98+ content = new StringContent (
99+ notification . Payload . ToString ( ) , // Get XML payload
100+ Encoding . UTF8 ,
101+ "text/xml" ) ;
102+ }
103+
97104 var result = await http . PostAsync ( notification . ChannelUri , content ) ;
98105
99106 var status = ParseStatus ( result , notification ) ;
You can’t perform that action at this time.
0 commit comments