From 3369d87da96e38772faa773b755189320ab5b81c Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Sun, 24 Nov 2013 11:13:49 +0000 Subject: [PATCH] Cleanup the redirect if blocks. --- requests/sessions.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/requests/sessions.py b/requests/sessions.py index c0a0e85..9c95b58 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -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 -- 2.34.1