Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Oct 24, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 10 pygithub3/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def _patch(self, request, **kwargs):
def _put(self, request, **kwargs):
""" Bug in Github API? requests library?

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)
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)

For instance:
- follow-user request doesn't send input data
Expand All @@ -125,7 +125,7 @@ def _put(self, request, **kwargs):

Related: https://github.com/github/developer.github.com/pull/52
"""
input_data = request.get_body() or 'PLACEHOLDER'
input_data = request.get_body() or ''
response = self._client.put(request, data=input_data, **kwargs)
if response.status_code != 204: # != NO_CONTENT
return request.resource.loads(response.content)
Expand Down
2 changes: 1 addition & 1 deletion 2 pygithub3/tests/services/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_BOOL(self, request_method):

def test_PUT(self, request_method):
self.s._put(self.r, **self.args)
data = 'PLACEHOLDER' # See _put
data = '' # See _put
request_method.assert_called_with('put', _('dummyrequest'),
data=data, params=self.args)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.