lib/rpush/daemon/wns/badge_request.rb in rpush-4.1.1 vs lib/rpush/daemon/wns/badge_request.rb in rpush-4.2.0
- old
+ new
@@ -2,17 +2,22 @@
module Daemon
module Wns
class BadgeRequest
def self.create(notification, access_token)
body = BadgeRequestPayload.new(notification).to_xml
- uri = URI.parse(notification.uri)
- post = Net::HTTP::Post.new(
- uri.request_uri,
+ uri = URI.parse(notification.uri)
+ headers = {
"Content-Length" => body.length.to_s,
"Content-Type" => "text/xml",
"X-WNS-Type" => "wns/badge",
"X-WNS-RequestForStatus" => "true",
"Authorization" => "Bearer #{access_token}"
+ }
+ headers['X-WNS-PRIORITY'] = notification.priority.to_s if notification.priority
+
+ post = Net::HTTP::Post.new(
+ uri.request_uri,
+ headers
)
post.body = body
post
end
end