]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Strip Transfer-Encoding when a switch-to-GET redirect is made
authorTom Christie <tom@tomchristie.com>
Wed, 4 Sep 2019 14:10:55 +0000 (15:10 +0100)
committerTom Christie <tom@tomchristie.com>
Wed, 4 Sep 2019 14:10:55 +0000 (15:10 +0100)
httpx/middleware.py

index b14037d4d0fdf787b3eb8705b2626bea2926a914..aa994dba58e958dbc22a9c39977a2773db0f7504 100644 (file)
@@ -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