Skip to content
Myr

Handle 301s 'properly'.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 3327652 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:requests/sessions.py+7 added-1 removed
110 unmodified lines
111 method != 'HEAD'):112 method = 'GET'113114 # Do what the browsers do, despite standards...115 if (resp.status_code in (codes.moved, codes.found) and115 # First, turn 302s into GETs.116 if (resp.status_code == codes.found and117 method not in ('GET', 'HEAD')):118 method = 'GET'119120 # Second, if a POST is responded to with a 301, turn it into a GET.121 # This bizarre behaviour is explained in Issue 1704.122 if (resp.status_code == codes.moved) and (method == 'POST'):123 method = 'GET'124125 prepared_request.method = method126127 # https://github.com/kennethreitz/requests/issues/1084128 if resp.status_code not in (codes.temporary, codes.resume):
410 unmodified lines