Merge "Don't decode empty response body"
This commit is contained in:
commit
15889916da
@ -816,6 +816,11 @@ class ClientV2TestJson(CLITestV20Base):
|
||||
self.mox.VerifyAll()
|
||||
self.mox.UnsetStubs()
|
||||
|
||||
def test_deserialize_without_data(self):
|
||||
data = u''
|
||||
result = self.client.deserialize(data, 200)
|
||||
self.assertEqual(data, result)
|
||||
|
||||
|
||||
class CLITestV20ExceptionHandler(CLITestV20Base):
|
||||
|
||||
|
@ -312,7 +312,8 @@ class ClientBase(object):
|
||||
|
||||
def deserialize(self, data, status_code):
|
||||
"""Deserializes a JSON string into a dictionary."""
|
||||
if status_code == 204:
|
||||
# TODO(hichihara): Remove checking 204 in bug 1611167
|
||||
if status_code == 204 or not data:
|
||||
return data
|
||||
return serializer.Serializer().deserialize(
|
||||
data)['body']
|
||||
|
Loading…
Reference in New Issue
Block a user