Only decode JSON as utf-8.

Reviewed in https://codereview.appspot.com/12377043/.
This commit is contained in:
Joe Gregorio
2013-08-02 17:21:54 -04:00
parent b983a6308d
commit 24a043bbf5

View File

@@ -195,7 +195,6 @@ class BaseModel(Model):
Raises:
apiclient.errors.HttpError if a non 2xx response is received.
"""
content = content.decode('utf-8')
self._log_response(resp, content)
# Error handling is TBD, for example, do we retry
# for some operation/error combinations?
@@ -258,6 +257,7 @@ class JsonModel(BaseModel):
return simplejson.dumps(body_value)
def deserialize(self, content):
content = content.decode('utf-8')
body = simplejson.loads(content)
if self._data_wrapper and isinstance(body, dict) and 'data' in body:
body = body['data']