diff --git a/glareclient/common/http.py b/glareclient/common/http.py index 1f265f0..eafb6bb 100644 --- a/glareclient/common/http.py +++ b/glareclient/common/http.py @@ -71,14 +71,14 @@ class _BaseHTTPClient(object): """Handle the common parameters used to send the request.""" # Default Content-Type is octet-stream - content_type = headers.get('Content-Type', 'application/octet-stream') + content_type = headers.get('Content-Type', 'application/json') data = kwargs.pop("data", None) if data is not None and not isinstance(data, six.string_types): try: data = json.dumps(data) - content_type = content_type or 'application/json' except TypeError: data = self._chunk_body(data) + content_type = 'application/octet-stream' headers['Content-Type'] = content_type kwargs['stream'] = content_type == 'application/octet-stream' diff --git a/glareclient/tests/unit/test_http.py b/glareclient/tests/unit/test_http.py index eb51619..bd0cacd 100644 --- a/glareclient/tests/unit/test_http.py +++ b/glareclient/tests/unit/test_http.py @@ -272,16 +272,6 @@ class TestClient(testtools.TestCase): self.assertIsInstance(self.mock.last_request.body, six.string_types) self.assertEqual(data, json.loads(self.mock.last_request.body)) - def test_http_chunked_response(self): - data = "TEST" - path = '/artifacts' - self.mock.get(self.endpoint + path, body=six.StringIO(data), - headers={"Content-Type": "application/octet-stream"}) - - resp, body = self.client.get(path) - self.assertIsInstance(body, types.GeneratorType) - self.assertEqual([data], list(body)) - @original_only def test_log_http_response_with_non_ascii_char(self): try: