djacobs / PyAPNs

Python library for interacting with the Apple Push Notification service (APNs)
http://pypi.python.org/pypi/apns/
MIT License
1.22k stars 374 forks source link

Not add 'aps' if empty #64

Closed ogreser closed 8 years ago

ogreser commented 10 years ago

The 'aps' is not required and we can save 8 bytes ("aps":{})

ExplodingCabbage commented 8 years ago

Are you sure this is safe? The docs are explicit about the "aps" dictionary being required (note the word "must"):

For each notification, compose a JSON dictionary object (as defined by RFC 4627). This dictionary must contain another dictionary identified by the aps key.

Of course, the docs may be wrong, but it seems safer to me to conform to them even if leaving the key out currently works?