Merge "microversion header for legacy endpoints removed"

This commit is contained in:
Jenkins 2016-03-07 21:16:21 +00:00 committed by Gerrit Code Review
commit a63bfeac76
2 changed files with 6 additions and 5 deletions

View File

@ -1060,6 +1060,10 @@ class Resource(wsgi.Application):
return self._process_stack(request, action, action_args, return self._process_stack(request, action, action_args,
content_type, body, accept) 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, def _process_stack(self, request, action, action_args,
content_type, body, accept): content_type, body, accept):
"""Implement the processing stack.""" """Implement the processing stack."""
@ -1168,7 +1172,8 @@ class Resource(wsgi.Application):
# python 3.x # python 3.x
response.headers[hdr] = six.text_type(val) 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] = ( response.headers[API_VERSION_REQUEST_HEADER] = (
VOLUME_SERVICE + ' ' + VOLUME_SERVICE + ' ' +
request.api_version_request.get_string()) request.api_version_request.get_string())

View File

@ -108,8 +108,6 @@ class VersionsControllerTestCase(test.TestCase):
ids = [v['id'] for v in version_list] ids = [v['id'] for v in version_list]
self.assertEqual({'v1.0'}, set(ids)) 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('min_version'))
self.assertEqual('', version_list[0].get('version')) self.assertEqual('', version_list[0].get('version'))
@ -126,8 +124,6 @@ class VersionsControllerTestCase(test.TestCase):
ids = [v['id'] for v in version_list] ids = [v['id'] for v in version_list]
self.assertEqual({'v2.0'}, set(ids)) 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('min_version'))
self.assertEqual('', version_list[0].get('version')) self.assertEqual('', version_list[0].get('version'))