werkzeug 2.3.3 compatibility

This commit is contained in:
David Lord 2023-05-02 07:05:51 -07:00
parent 726d3f4fa9
commit 3fbfbad79f
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 16 additions and 3 deletions

View file

@ -3,6 +3,8 @@ Version 2.2.5
Unreleased
- Update for compatibility with Werkzeug 2.3.3.
Version 2.2.4
-------------

View file

@ -168,10 +168,21 @@ class FlaskClient(Client):
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
)