From: Tom Christie Date: Wed, 4 Sep 2019 14:10:55 +0000 (+0100) Subject: Strip Transfer-Encoding when a switch-to-GET redirect is made X-Git-Tag: 0.7.3~21^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69982ed46c2ceee3837d8e26c0fd48c9ec32ca95;p=thirdparty%2Fhttpx.git Strip Transfer-Encoding when a switch-to-GET redirect is made --- diff --git a/httpx/middleware.py b/httpx/middleware.py index b14037d4..aa994dba 100644 --- a/httpx/middleware.py +++ b/httpx/middleware.py @@ -151,8 +151,10 @@ class RedirectMiddleware(BaseMiddleware): del headers["Host"] if method != request.method and method == "GET": - # Strip Content-Length headers when we've switch to a 'GET' request. + # If we've switch to a 'GET' request, then strip any headers which + # are only relevant to the request body. del headers["Content-Length"] + del headers["Transfer-Encoding"] return headers