Skip to content

Commit 1c93f93

Browse files
authored
Fixed Python & feature test failures caused by Werkzeug 3.1.7 rejecting empty Host header in CSRF token generation.
1 parent 3ba8870 commit 1c93f93

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

web/regression/python_test_utils/csrf_test_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ def generate_csrf_token(self, *args, **kwargs):
9393
# this test client, such as the secure cookie that
9494
# powers `flask.session`,
9595
# and make a test request context that has those cookies in it.
96+
server_name = self.app.config.get("SERVER_NAME") or "localhost"
9697
environ_overrides = {
97-
'wsgi.url_scheme': ''
98+
'wsgi.url_scheme': 'http',
99+
'HTTP_HOST': server_name
98100
}
99101
self._add_cookies_to_wsgi(environ_overrides)
100102

0 commit comments

Comments
 (0)