Skip to content

Commit

Permalink
Use stripped BODY for json client api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Oct 11, 2015
1 parent 956a0db commit 6a19364
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,14 @@ def json(self, *, encoding=None, loads=json.loads):
client_logger.warning(
'Attempt to decode JSON with unexpected mimetype: %s', ctype)

if not self._content.strip():
stripped = self._content.strip()
if not stripped:
return None

if encoding is None:
encoding = self._get_encoding()

return loads(self._content.decode(encoding))
return loads(stripped.decode(encoding))

if PY_35:
@asyncio.coroutine
Expand Down

0 comments on commit 6a19364

Please sign in to comment.