diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-09-14 17:55:15 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2011-09-14 17:55:15 +0000 |
| commit | 8638db07c4ad2177249a70708969c7a1cba09037 (patch) | |
| tree | 4cc29719e6c7a9b988b88c40712734e5b3ded99a /nova/api | |
| parent | 4fa96895f1c32e09db31532886d67a675fe66208 (diff) | |
Don't report the wrong content type if a mapped type doesn't exist
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/wsgi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index c68a57cb5..fad516d4d 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -281,8 +281,8 @@ class RequestDeserializer(object): def get_body_deserializer(self, content_type): try: - content_type = _CONTENT_TYPE_MAP.get(content_type, content_type) - return self.body_deserializers[content_type] + ctype = _CONTENT_TYPE_MAP.get(content_type, content_type) + return self.body_deserializers[ctype] except (KeyError, TypeError): raise exception.InvalidContentType(content_type=content_type) @@ -471,13 +471,13 @@ class ResponseSerializer(object): def serialize_body(self, response, data, content_type, action): response.headers['Content-Type'] = content_type if data is not None: - content_type = _CONTENT_TYPE_MAP.get(content_type, content_type) serializer = self.get_body_serializer(content_type) response.body = serializer.serialize(data, action) def get_body_serializer(self, content_type): try: - return self.body_serializers[content_type] + ctype = _CONTENT_TYPE_MAP.get(content_type, content_type) + return self.body_serializers[ctype] except (KeyError, TypeError): raise exception.InvalidContentType(content_type=content_type) |
