Skip to content

Commit ccd417e

Browse files
committed
Fix disabling of location header autocorrect for werkzeug 2+ (#647)
In werkzeug 2.0.0 and later, the Location header autocorrection moved from BaseResponse to Response, so we need to set `autocorrect_location_header = False` in `Response` not `BaseResponse`. For now let's just set it in both to be safe, this doesn't cause any errors at least with 1.0.1 and 2.0.1. Signed-off-by: Adam Williamson <awilliam@redhat.com>
1 parent 992eaa4 commit ccd417e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

httpbin/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ def jsonify(*args, **kwargs):
7777

7878

7979
# Prevent WSGI from correcting the casing of the Location header
80+
# and forcing it to be absolute. This moved from BaseResponse to
81+
# Response in werkzeug 2.0.0, so we set both to be safe.
8082
BaseResponse.autocorrect_location_header = False
83+
Response.autocorrect_location_header = False
8184

8285
# Find the correct template folder when running from a different location
8386
tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")

0 commit comments

Comments
 (0)