diff --git a/cinder/api/openstack/wsgi.py b/cinder/api/openstack/wsgi.py index 8335b14b8e7..dd3df2d272b 100644 --- a/cinder/api/openstack/wsgi.py +++ b/cinder/api/openstack/wsgi.py @@ -1060,6 +1060,10 @@ class Resource(wsgi.Application): return self._process_stack(request, action, action_args, content_type, body, accept) + def _is_legacy_endpoint(self, request): + version_str = request.api_version_request.get_string() + return '1.0' in version_str or '2.0' in version_str + def _process_stack(self, request, action, action_args, content_type, body, accept): """Implement the processing stack.""" @@ -1168,7 +1172,8 @@ class Resource(wsgi.Application): # python 3.x response.headers[hdr] = six.text_type(val) - if not request.api_version_request.is_null(): + if (not request.api_version_request.is_null() and + not self._is_legacy_endpoint(request)): response.headers[API_VERSION_REQUEST_HEADER] = ( VOLUME_SERVICE + ' ' + request.api_version_request.get_string()) diff --git a/cinder/tests/unit/api/test_versions.py b/cinder/tests/unit/api/test_versions.py index 1c8fd8969d2..0f85c0e04b7 100644 --- a/cinder/tests/unit/api/test_versions.py +++ b/cinder/tests/unit/api/test_versions.py @@ -108,8 +108,6 @@ class VersionsControllerTestCase(test.TestCase): ids = [v['id'] for v in version_list] self.assertEqual({'v1.0'}, set(ids)) - self.check_response(response, version) - self.assertEqual('', version_list[0].get('min_version')) self.assertEqual('', version_list[0].get('version')) @@ -126,8 +124,6 @@ class VersionsControllerTestCase(test.TestCase): ids = [v['id'] for v in version_list] self.assertEqual({'v2.0'}, set(ids)) - self.check_response(response, version) - self.assertEqual('', version_list[0].get('min_version')) self.assertEqual('', version_list[0].get('version'))