Cleanup the redirect if blocks.
authorCory Benfield <lukasaoz@gmail.com>
Sun, 24 Nov 2013 11:13:49 +0000 (11:13 +0000)
committerCory Benfield <lukasaoz@gmail.com>
Sun, 24 Nov 2013 11:13:49 +0000 (11:13 +0000)
requests/sessions.py

index c0a0e8514a711489e2ce7844210a5afbacea95fd..9c95b58d9bc70a3c587569a2907b2dbb483c5546 100644 (file)
@@ -113,13 +113,12 @@ class SessionRedirectMixin(object):
 
             # Do what the browsers do, despite standards...
             # First, turn 302s into GETs.
-            if (resp.status_code == codes.found and
-                    method not in ('GET', 'HEAD')):
+            if resp.status_code == codes.found and method != 'HEAD':
                 method = 'GET'
 
             # Second, if a POST is responded to with a 301, turn it into a GET.
             # This bizarre behaviour is explained in Issue 1704.
-            if (resp.status_code == codes.moved) and (method == 'POST'):
+            if resp.status_code == codes.moved and method == 'POST':
                 method = 'GET'
 
             prepared_request.method = method