Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Werkzeug 2.1.0 change to Response.autocorrect_location_header. #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/legacy/test_api_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,17 @@ def get(self):
def test_redirect(self, api, client):
class FooResource(restx.Resource):
def get(self):
return redirect("/")
response = redirect("/")
# Response.autocorrect_location_header = False is now the default in Werkzeug >= 2.1
# It is explicitly set here so the test remains backwards compatible with previous versions of Werkzeug.
response.autocorrect_location_header = False
return response

api.add_resource(FooResource, "/api")

resp = client.get("/api")
assert resp.status_code == 302
assert resp.headers["Location"] == "http://localhost/"
assert resp.headers["Location"] == "/"

def test_calling_owns_endpoint_before_api_init(self):
api = restx.Api()
Expand Down