← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/git-hosting-more-no-content into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/git-hosting-more-no-content into lp:launchpad.

Commit message:
Return None from GitHostingClient._request if there is no response content.

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-hosting-more-no-content/+merge/261988

Another failure in code that I haven't quite managed to unit-test yet. :-(  Return None from GitHostingClient._request if there is no response content.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/code/model/githosting.py'
--- lib/lp/code/model/githosting.py	2015-06-15 15:12:32 +0000
+++ lib/lp/code/model/githosting.py	2015-06-15 16:44:21 +0000
@@ -60,7 +60,10 @@
             urljoin(self.endpoint, path), timeout=self.timeout, **kwargs)
         if (response.status_code // 100) != 2:
             raise HTTPResponseNotOK(response.text)
-        return response.json()
+        elif response.content:
+            return response.json()
+        else:
+            return None
 
     def _get(self, path, **kwargs):
         return self._request("get", path, **kwargs)


References