diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py index d406540dc7..200e9682ff 100644 --- a/swift/proxy/controllers/base.py +++ b/swift/proxy/controllers/base.py @@ -728,8 +728,8 @@ class Controller(object): resp.status = HTTP_UNAUTHORIZED return resp # CORS preflight request that isn't valid headers['access-control-allow-origin'] = req_origin_value - if cors.get('max_age', None) is not None: - headers['access-control-max-age'] = '%d' % cors.get('max_age') + if cors.get('max_age') is not None: + headers['access-control-max-age'] = cors.get('max_age') headers['access-control-allow-methods'] = ', '.join( self.allowed_methods) if cors.get('allow_headers'): diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py index 6e05364735..089ce46859 100755 --- a/test/unit/proxy/test_server.py +++ b/test/unit/proxy/test_server.py @@ -3535,7 +3535,7 @@ class TestObjectController(unittest.TestCase): 'cors': { 'allow_origin': 'http://foo.bar:8080 https://foo.bar', 'allow_headers': 'x-foo', - 'max_age': 999, + 'max_age': '999', } } controller.container_info = my_container_info @@ -3595,7 +3595,7 @@ class TestObjectController(unittest.TestCase): 'cors': { 'allow_origin': '*', 'allow_headers': 'x-foo', - 'max_age': 999, + 'max_age': '999', } } controller.container_info = my_container_info_wildcard @@ -4141,7 +4141,7 @@ class TestContainerController(unittest.TestCase): 'cors': { 'allow_origin': 'http://foo.bar:8080 https://foo.bar', 'allow_headers': 'x-foo', - 'max_age': 999, + 'max_age': '999', } } controller.container_info = my_container_info @@ -4202,7 +4202,7 @@ class TestContainerController(unittest.TestCase): 'cors': { 'allow_origin': '*', 'allow_headers': 'x-foo', - 'max_age': 999, + 'max_age': '999', } } controller.container_info = my_container_info_wildcard