From 06432e8e945623617063bf4d4fccef382e42a21d Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Sun, 24 Apr 2011 08:37:40 -0500 Subject: [PATCH] Don't try to update from a response that has no content. --- remoteobjects/http.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/remoteobjects/http.py b/remoteobjects/http.py index d4dc148..6bab3d4 100644 --- a/remoteobjects/http.py +++ b/remoteobjects/http.py @@ -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: