microversion header for legacy endpoints removed

With the current implementation, a microversion header will be returned
even if /v1 or /v2 API endpoints are used.
This is wrong, and constitutes an API change. Remove this header for
legacy endpoints /v1 and /v2.

Change-Id: Ided4fb35bd5cd5af512e777f9e4af275754097be
Closes-Bug: #1553194
This commit is contained in:
scottda 2016-03-04 06:45:25 -07:00
parent 6ae82c51c9
commit bd66dd9cca
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,
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())

View File

@ -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'))