diff --git a/autopush/router/apnsrouter.py b/autopush/router/apnsrouter.py index ba3d09d6..3ec3e00c 100644 --- a/autopush/router/apnsrouter.py +++ b/autopush/router/apnsrouter.py @@ -133,7 +133,7 @@ def _route(self, notification, router_data): payload["cryptokey"] = notification.headers["crypto_key"] elif "encryption_key" in notification.headers: payload["enckey"] = notification.headers["encryption_key"] - payload['aps'] = {"content-available": 1} + payload['aps'] = router_data.get('aps', {"content-available": 1}) apns_id = str(uuid.uuid4()).lower() try: apns_client.send(router_token=router_token, payload=payload, diff --git a/autopush/tests/test_router.py b/autopush/tests/test_router.py index 315c4a1f..e7b13680 100644 --- a/autopush/tests/test_router.py +++ b/autopush/tests/test_router.py @@ -133,6 +133,14 @@ def test_register(self): self.router.register("uaid", router_data=router_data, app_id="firefox") eq_(router_data, {"rel_channel": "firefox", "token": "connect_data"}) + def test_extended_register(self): + router_data = {"token": "connect_data", + "aps": {"foo": "bar", + "gorp": "baz"}} + self.router.register("uaid", router_data=router_data, app_id="firefox") + eq_(router_data, {"rel_channel": "firefox", "token": "connect_data", + "aps": {"foo": "bar", "gorp": "baz"}}) + def test_register_bad(self): with assert_raises(RouterException): self.router.register("uaid", router_data={}, app_id="firefox")