diff --git a/AUTHORS b/AUTHORS index 21cc61535..930e564f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -32,6 +32,7 @@ Kiall Mac Innes Kirill Shileev Lvov Maxim Matt Dietz +Matt Stephenson Nicholas Mistry Nikolay Sokolov Pavel Shkitin diff --git a/novaclient/client.py b/novaclient/client.py index 855494270..5c40fd7b3 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -82,6 +82,7 @@ class HTTPClient(httplib2.Http): def request(self, *args, **kwargs): kwargs.setdefault('headers', kwargs.get('headers', {})) kwargs['headers']['User-Agent'] = self.USER_AGENT + kwargs['headers']['Accept'] = 'application/json' if 'body' in kwargs: kwargs['headers']['Content-Type'] = 'application/json' kwargs['body'] = json.dumps(kwargs['body']) diff --git a/tests/test_http.py b/tests/test_http.py index 2d1db58cc..d7847cc2c 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -36,6 +36,7 @@ class ClientTest(utils.TestCase): headers = {"X-Auth-Token": "token", "X-Auth-Project-Id": "project_id", "User-Agent": cl.USER_AGENT, + 'Accept': 'application/json', } mock_request.assert_called_with("http://example.com/hi", "GET", headers=headers) @@ -54,6 +55,7 @@ class ClientTest(utils.TestCase): "X-Auth-Token": "token", "X-Auth-Project-Id": "project_id", "Content-Type": "application/json", + 'Accept': 'application/json', "User-Agent": cl.USER_AGENT } mock_request.assert_called_with("http://example.com/hi", "POST", diff --git a/tests/v1_1/test_auth.py b/tests/v1_1/test_auth.py index d179e497e..4bd68635b 100644 --- a/tests/v1_1/test_auth.py +++ b/tests/v1_1/test_auth.py @@ -55,6 +55,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): headers = { 'User-Agent': cs.client.USER_AGENT, 'Content-Type': 'application/json', + 'Accept': 'application/json', } body = { 'auth': { @@ -152,6 +153,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase): headers = { 'User-Agent': cs.client.USER_AGENT, 'Content-Type': 'application/json', + 'Accept': 'application/json', } body = { 'auth': { @@ -244,6 +246,7 @@ class AuthenticationTests(utils.TestCase): def test_auth_call(): cs.client.authenticate() headers = { + 'Accept': 'application/json', 'X-Auth-User': 'username', 'X-Auth-Key': 'password', 'X-Auth-Project-Id': 'project_id',