From: Ian Cordasco Date: Sun, 10 Feb 2013 22:14:45 +0000 (-0500) Subject: Resolve @piotr-dobrogost's concerns X-Git-Tag: v1.2.0~48^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c8660dbb6e5d9b8694447e91e7936161f868ab0;p=services%2Fpython-requests.git Resolve @piotr-dobrogost's concerns Piotr had good objections to my not re-sending the body of the request on 307. --- diff --git a/requests/sessions.py b/requests/sessions.py index 01534c9..406d78e 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -125,15 +125,16 @@ class SessionRedirectMixin(object): prepared_request.method = method - # Remove the cookie headers that were sent. - headers = prepared_request.headers - for h in ('Cookie', 'Content-Length'): - try: - del headers[h] - except KeyError: - pass - - prepared_request.body = None + if resp.status_code is not codes.temporary: + if 'Content-Length' in prepared_request.headers: + del prepared_request.headers['Content-Length'] + + prepared_request.body = None + + try: + del prepared_request.headers['Cookie'] + except KeyError: + pass resp = self.send( prepared_request,