diff options
author | 2012-04-24 09:10:06 +0200 | |
---|---|---|
committer | 2012-04-24 09:10:54 +0200 | |
commit | b488b8447fc943d920cd72b60c6647e5840ff800 (patch) | |
tree | 97427dc74a27aa42d125aabba88b49c74c3d633c /pygithub3 | |
parent | Add Orgs Members API (diff) | |
download | python-github3-b488b8447fc943d920cd72b60c6647e5840ff800.tar.xz python-github3-b488b8447fc943d920cd72b60c6647e5840ff800.zip |
An empty string doesn't work around the 411 issue on PUTs. Use 'PLACEHOLDER'
Diffstat (limited to 'pygithub3')
-rw-r--r-- | pygithub3/services/base.py | 10 | ||||
-rw-r--r-- | pygithub3/tests/services/test_core.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/pygithub3/services/base.py b/pygithub3/services/base.py index 886a666..c91bc72 100644 --- a/pygithub3/services/base.py +++ b/pygithub3/services/base.py @@ -105,10 +105,10 @@ class Service(object): def _put(self, request, **kwargs): """ Bug in Github API? requests library? - I must send data as empty string when the specifications' of some PUT - request are 'Not send input data'. If I don't do that and send data as - None, the requests library doesn't send 'Content-length' header and the - server returns 411 - Required Content length (at least 0) + I must send data when the specifications' of some PUT request are 'Not + send input data'. If I don't do that and send data as None, the + requests library doesn't send 'Content-length' header and the server + returns 411 - Required Content length (at least 0) For instance: - follow-user request doesn't send input data @@ -119,7 +119,7 @@ class Service(object): Related: https://github.com/github/developer.github.com/pull/52 """ - input_data = request.get_body() or '' + input_data = request.get_body() or 'PLACEHOLDER' response = self._client.put(request, data=input_data, **kwargs) if response.status_code != 204: # != NO_CONTENT return request.resource.loads(response.content) diff --git a/pygithub3/tests/services/test_core.py b/pygithub3/tests/services/test_core.py index bd95b34..8a2bbbe 100644 --- a/pygithub3/tests/services/test_core.py +++ b/pygithub3/tests/services/test_core.py @@ -27,7 +27,7 @@ class TestServiceCalls(TestCase): def test_PUT(self, request_method): self.s._put(self.r, **self.args) - data = '' # See _put + data = 'PLACEHOLDER' # See _put request_method.assert_called_with('put', _('dummyrequest'), data=data, params=self.args) |