Skip to content
Myr

Merge pull request #1754 from Lukasa/verb_change

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

Match the HTTPbis on HTTP 301.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 3327652, 3369d87 · Browse files · 1 file+7 added−2 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−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:requests/sessions.py+7 added-2 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) and116 method not in ('GET', 'HEAD')):115 # First, turn 302s into GETs.116 if resp.status_code == codes.found and method != 'HEAD':117 method = 'GET'118119 # Second, if a POST is responded to with a 301, turn it into a GET.120 # This bizarre behaviour is explained in Issue 1704.121 if resp.status_code == codes.moved and method == 'POST':122 method = 'GET'123124 prepared_request.method = method125126 # https://github.com/kennethreitz/requests/issues/1084127 if resp.status_code not in (codes.temporary, codes.resume):
410 unmodified lines