Ejemplo n.º 1
0
def max_version():
    return base.Version(
        {
            base.Version.string:
            ' '.join([
                versions.service_type_string(),
                versions.max_version_string()
            ])
        }, versions.min_version_string(), versions.max_version_string())
Ejemplo n.º 2
0
    def _route(self, args, request=None):
        v = base.Version(pecan.request.headers, versions.min_version_string(),
                         versions.max_version_string())

        # The Vary header is used as a hint to caching proxies and user agents
        # that the response is also dependent on the OpenStack-API-Version and
        # not just the body and query parameters. See RFC 7231 for details.
        pecan.response.headers['Vary'] = base.Version.string

        # Always set the min and max headers
        pecan.response.headers[base.Version.min_string] = (
            versions.min_version_string())
        pecan.response.headers[base.Version.max_string] = (
            versions.max_version_string())

        # assert that requested version is supported
        self._check_version(v, pecan.response.headers)
        pecan.response.headers[base.Version.string] = str(v)
        pecan.request.version = v

        return super(Controller, self)._route(args, request)