Cleaning up a previous mistake and catching another error
@@ -50,12 +50,13 @@ class JsonSerializer(object):
return json.loads(headers)
def deserialize_body(self, obj):
- if six.PY3:
- if isinstance(obj, bytes):
+ if six.PY3 and isinstance(obj, bytes):
obj = obj.decode('utf8')
if not obj:
return {}
return json.loads(obj)
def serialize_body(self, obj):
+ if six.PY3 and isinstance(obj, bytes):
+ obj = obj.decode('utf8')
return json.dumps(obj)
