From a5d6df0630f6df4c5881071a4deebc6f2e32af79 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Wed, 27 Mar 2013 16:09:18 +1300 Subject: [PATCH] Return the body as a string instead of an iterable. Heat REST API will never return an application/octet-stream so this removes some dead code. Change-Id: Ia0d35c898ba92924ba82d50f1cfde14b299569e5 --- heatclient/common/http.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/heatclient/common/http.py b/heatclient/common/http.py index 73fa4236..576e3642 100644 --- a/heatclient/common/http.py +++ b/heatclient/common/http.py @@ -156,14 +156,8 @@ class HTTPClient(object): raise exc.CommunicationError(message=message) body_iter = ResponseBodyIterator(resp) - - # Read body into string if it isn't obviously image data - if resp.getheader('content-type', None) != 'application/octet-stream': - body_str = ''.join([chunk for chunk in body_iter]) - self.log_http_response(resp, body_str) - body_iter = StringIO.StringIO(body_str) - else: - self.log_http_response(resp) + body_str = ''.join([chunk for chunk in body_iter]) + self.log_http_response(resp, body_str) if 400 <= resp.status < 600: raise exc.from_response(resp, body_iter) @@ -183,7 +177,7 @@ class HTTPClient(object): elif resp.status == 300: raise exc.from_response(resp, body_iter) - return resp, body_iter + return resp, body_str def json_request(self, method, url, **kwargs): kwargs.setdefault('headers', {})