Don't try to update from a response that has no content.

This commit is contained in:
Carl Meyer 2011-04-24 08:37:40 -05:00
Родитель 73c5b8f5a0
Коммит 06432e8e94
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -262,12 +262,13 @@ class HttpObject(DataObject):
"""
self.raise_for_response(url, response, content)
try:
data = json.loads(content)
except UnicodeDecodeError:
data = json.loads(content, cls=ForgivingDecoder)
if self.response_has_content.get(response.status):
try:
data = json.loads(content)
except UnicodeDecodeError:
data = json.loads(content, cls=ForgivingDecoder)
self.update_from_dict(data)
self.update_from_dict(data)
location_header = self.location_headers.get(response.status)
if location_header is None: