pwa: add Urgency: low header (#70987)
gitea/combo/pipeline/head This commit looks good Details

This commit is contained in:
Benjamin Dauvergne 2024-01-10 11:05:47 +01:00
parent 9f25287a66
commit a5f8140d66
2 changed files with 3 additions and 2 deletions

View File

@ -67,6 +67,7 @@ def send_webpush(private_key, subscription_info, **kwargs):
message = json.dumps(kwargs)
headers = get_vapid_headers(private_key, subscription_info)
headers['Urgency'] = 'low'
webpusher = pywebpush.WebPusher(subscription_info)
response = webpusher.send(
data=message,

View File

@ -97,7 +97,7 @@ def test_webpush_notification(app, john_doe, caplog):
mock.call({'sample': 'content', 'endpoint': 'https://push.example.com:1000/'}),
mock.call().send(
data='{"summary": "test", "body": "hello world", "url": ""}',
headers={'Authorization': mock.ANY},
headers={'Authorization': mock.ANY, 'Urgency': 'low'},
ttl=2592000,
),
mock.call().send().raise_for_status(),
@ -113,7 +113,7 @@ def test_webpush_notification(app, john_doe, caplog):
mock.call({'sample': 'content', 'endpoint': 'https://push.example.com:1000/'}),
mock.call().send(
data='{"summary": "test", "body": "hello world", "url": ""}',
headers={'Authorization': mock.ANY},
headers={'Authorization': mock.ANY, 'Urgency': 'low'},
ttl=2592000,
),
mock.call().send().raise_for_status(),