Browse Source

add status code 308 to _REDIRECT_STATUSES

add status code 308 to _REDIRECT_STATUSES as designed by rfc7238
Closes-bug: 1610914

Change-Id: I81ce137dad07e76a0f0c227dc8b263eec64fff7a
Alexey Stepanov 2 years ago
parent
commit
837118393c
2 changed files with 7 additions and 1 deletions
  1. 1
    1
      keystoneauth1/session.py
  2. 6
    0
      keystoneauth1/tests/unit/test_session.py

+ 1
- 1
keystoneauth1/session.py View File

@@ -211,7 +211,7 @@ class Session(object):
211 211
 
212 212
     user_agent = None
213 213
 
214
-    _REDIRECT_STATUSES = (301, 302, 303, 305, 307)
214
+    _REDIRECT_STATUSES = (301, 302, 303, 305, 307, 308)
215 215
 
216 216
     _DEFAULT_REDIRECT_LIMIT = 30
217 217
 

+ 6
- 0
keystoneauth1/tests/unit/test_session.py View File

@@ -362,6 +362,12 @@ class RedirectTests(utils.TestCase):
362 362
             self.assertEqual(r.url, s.url)
363 363
             self.assertEqual(r.status_code, s.status_code)
364 364
 
365
+    def test_permanent_redirect_308(self):
366
+        session = client_session.Session()
367
+        self.setup_redirects(status_code=308)
368
+        resp = session.get(self.REDIRECT_CHAIN[-2])
369
+        self.assertResponse(resp)
370
+
365 371
 
366 372
 class AuthPlugin(plugin.BaseAuthPlugin):
367 373
     """Very simple debug authentication plugin.

Loading…
Cancel
Save