Change redirect status from 307 to 308

webob start to support 308 at version 1.5.0

"HTTP Status Code 308 is now supported as a Permanent Redirect"

Change-Id: I27eef9585e88ef4e75678b9c7530bca230c3b42b
This commit is contained in:
zhangshengping2012 2016-10-26 12:55:09 +08:00
parent 98d37b92c1
commit 2c7f5e159f
3 changed files with 10 additions and 15 deletions

View File

@ -72,13 +72,8 @@ def aodh_abort():
def _redirect(url):
# NOTE(sileht): we use 307 and not 301 or 302 to allow
# client to redirect POST/PUT/DELETE/...
# FIXME(sileht): it would be better to use 308, but webob
# doesn't handle it :(
# https://github.com/Pylons/webob/pull/207
pecan.redirect(location=url + pecan.request.path_qs,
code=307)
code=308)
class QueryController(object):

View File

@ -97,21 +97,21 @@ class TestAPIUpgradePath(v2.FunctionalTest):
response = self.app.get(self.PATH_PREFIX + '/alarms',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://alarm-endpoint:8008/v2/alarms",
response.headers['Location'])
response = self.app.get(self.PATH_PREFIX + '/alarms/uuid',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://alarm-endpoint:8008/v2/alarms/uuid",
response.headers['Location'])
response = self.app.delete(self.PATH_PREFIX + '/alarms/uuid',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://alarm-endpoint:8008/v2/alarms/uuid",
response.headers['Location'])
@ -120,7 +120,7 @@ class TestAPIUpgradePath(v2.FunctionalTest):
"filter": '{"=": {"type": "creation"}}',
"orderby": '[{"timestamp": "DESC"}]',
"limit": 3
}, status=307)
}, status=308)
self.assertEqual("http://alarm-endpoint:8008/v2/query/alarms",
response.headers['Location'])
@ -128,28 +128,28 @@ class TestAPIUpgradePath(v2.FunctionalTest):
response = self.app.get(self.PATH_PREFIX + '/events',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://event-endpoint:8009/v2/events",
response.headers['Location'])
response = self.app.get(self.PATH_PREFIX + '/events/uuid',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://event-endpoint:8009/v2/events/uuid",
response.headers['Location'])
response = self.app.delete(self.PATH_PREFIX + '/events/uuid',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://event-endpoint:8009/v2/events/uuid",
response.headers['Location'])
response = self.app.get(self.PATH_PREFIX + '/event_types',
expect_errors=True)
self.assertEqual(307, response.status_code)
self.assertEqual(308, response.status_code)
self.assertEqual("http://event-endpoint:8009/v2/event_types",
response.headers['Location'])

View File

@ -42,7 +42,7 @@ SQLAlchemy<1.1.0,>=1.0.10 # MIT
sqlalchemy-migrate>=0.9.6 # Apache-2.0
stevedore>=1.9.0 # Apache-2.0
tooz>=1.28.0 # Apache-2.0
WebOb>=1.2.3 # MIT
WebOb>=1.5.0 # MIT
WSME>=0.8 # MIT
# NOTE(jd) We do not import it directly, but WSME datetime string parsing
# behaviour changes when this library is installed