diff options
author | Cedric Brandily <zzelle@gmail.com> | 2014-09-11 21:14:18 +0200 |
---|---|---|
committer | Cedric Brandily <zzelle@gmail.com> | 2014-09-15 15:44:42 +0200 |
commit | fb83043e152e2181ed2431125bba32d89e3908b7 (patch) | |
tree | 14cdd261cfe7395d7ec3033c2615469ecf8daee2 /neutronclient/v2_0 | |
parent | 5832a54c0730840257a7cddc277ea0c5742f3528 (diff) | |
download | python-neutronclient-fb83043e152e2181ed2431125bba32d89e3908b7.tar.gz |
Correct Content-Type/Accept management in HTTPClient/SessionClient
Currently SessionClient.request never specifies Content-Type/Accept
headers in requests where HTTPClient.request always specifies json
Content-Type/Accept even with "--request-format xml" option ... requests
succeed because neutron deduces Content-Type/Accept from url suffix when
defined.
This change ensures HTTPClient/SessionClient define Content-Type/Accept
headers when needed and align them with --request-format option.
Closes-Bug: #1368335
Change-Id: I909e055e5e59fa5870a28ebb0f171812acca0745
Diffstat (limited to 'neutronclient/v2_0')
-rw-r--r-- | neutronclient/v2_0/client.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index 393fd96..eb84125 100644 --- a/neutronclient/v2_0/client.py +++ b/neutronclient/v2_0/client.py @@ -1235,8 +1235,11 @@ class Client(object): if body: body = self.serialize(body) - self.httpclient.content_type = self.content_type() - resp, replybody = self.httpclient.do_request(action, method, body=body) + + resp, replybody = self.httpclient.do_request( + action, method, body=body, + content_type=self.content_type()) + status_code = resp.status_code if status_code in (requests.codes.ok, requests.codes.created, |