-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support adding arbitrary HTTP headers when using webpush() Useful for adding headers like `Topic` an `Urgency` that don't have dedicated parameters. * Send headers provided in the `--head` CLI argument
- Loading branch information
Showing
3 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,8 @@ def test_send_vapid(self, mock_post): | |
data=data, | ||
vapid_private_key=self.vapid_key, | ||
vapid_claims={"sub": "mailto:[email protected]"}, | ||
content_encoding="aesgcm" | ||
content_encoding="aesgcm", | ||
headers={"Test-Header": "test-value"} | ||
) | ||
eq_(subscription_info.get('endpoint'), mock_post.call_args[0][0]) | ||
pheaders = mock_post.call_args[1].get('headers') | ||
|
@@ -173,6 +174,7 @@ def repad(str): | |
ckey = pheaders.get('crypto-key') | ||
ok_('dh=' in ckey) | ||
eq_(pheaders.get('content-encoding'), 'aesgcm') | ||
eq_(pheaders.get('test-header'), 'test-value') | ||
|
||
@patch.object(WebPusher, "send") | ||
@patch.object(py_vapid.Vapid, "sign") | ||
|