8000 gh-545 Add content type header of application/x-www-form-urlencoded t… · goodwillcoding/github3.py@772d047 · GitHub
[go: up one dir, main page]

Skip to content

Commit 772d047

Browse files
committed
sigmavirus24gh-545 Add content type header of application/x-www-form-urlencoded to _post() call
1 parent a4b9ba9 commit 772d047

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

github3/github.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,11 @@ def pubsubhubbub(self, mode, topic, callback, secret=''):
10091009
# This is not JSON data. It is meant to be form data
10101010
# application/x-www-form-urlencoded works fine here, no need for
10111011
# multipart/form-data
1012-
status = self._boolean(self._post(url, data=data, json=False), 204,
1013-
404)
1012+
status = self._boolean(self._post(url, data=data, json=False,
1013+
headers={
1014+
'Content-Type':
1015+
'application/x-www-form-urlencoded'
1016+
}), 204, 404)
10141017
return status
10151018

10161019
def pull_request(self, owner, repository, number):

tests/unit/test_github.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,11 @@ def test_pubsubhubbub(self):
409409
self.instance.pubsubhubbub(**data)
410410
self.session.post.assert_called_once_with(
411411
url_for('hub'),
412-
body
412+
body,
413+
headers={
414+
'Content-Type':
415+
'application/x-www-form-urlencoded'
416+
}
413417
)
414418

415419
def test_pubsubhubbub_secret(self):
@@ -426,7 +430,11 @@ def test_pubsubhubbub_secret(self):
426430
self.instance.pubsubhubbub(**data)
427431
self.session.post.assert_called_once_with(
428432
url_for('hub'),
429-
body
433+
body,
434+
headers={
435+
'Content-Type':
436+
'application/x-www-form-urlencoded'
437+
}
430438
)
431439

432440
def test_pubsubhubbub_required_callback(self):

0 commit comments

Comments
 (0)
0