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

werkzeug 2.3.3 compatibility #5108

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Version 2.2.5

Unreleased

- Update for compatibility with Werkzeug 2.3.3.


Version 2.2.4
-------------
Expand Down
17 changes: 14 additions & 3 deletions src/flask/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,21 @@ def session_transaction(
app.session_interface.save_session(app, sess, resp)

if hasattr(self, "_update_cookies_from_response"):
self._update_cookies_from_response(
ctx.request.host.partition(":")[0], resp.headers.getlist("Set-Cookie")
)
try:
# Werkzeug>=2.3.3
self._update_cookies_from_response(
ctx.request.host.partition(":")[0],
ctx.request.path,
resp.headers.getlist("Set-Cookie"),
)
except TypeError:
# Werkzeug>=2.3.0,<2.3.3
self._update_cookies_from_response( # type: ignore[call-arg]
ctx.request.host.partition(":")[0],
resp.headers.getlist("Set-Cookie"), # type: ignore[arg-type]
)
else:
# Werkzeug<2.3.0
self.cookie_jar.extract_wsgi( # type: ignore[union-attr]
ctx.request.environ, resp.headers
)
Expand Down