pass context through dispatch methods

This commit is contained in:
David Lord 2025-09-19 16:58:48 -07:00
parent adf363679d
commit 6a64969009
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
6 changed files with 167 additions and 72 deletions

View file

@ -288,8 +288,9 @@ def test_bad_environ_raises_bad_request():
# use a non-printable character in the Host - this is key to this test
environ["HTTP_HOST"] = "\x8a"
with app.request_context(environ):
response = app.full_dispatch_request()
with app.request_context(environ) as ctx:
response = app.full_dispatch_request(ctx)
assert response.status_code == 400
@ -308,8 +309,8 @@ def test_environ_for_valid_idna_completes():
# these characters are all IDNA-compatible
environ["HTTP_HOST"] = "ąśźäüжŠßя.com"
with app.request_context(environ):
response = app.full_dispatch_request()
with app.request_context(environ) as ctx:
response = app.full_dispatch_request(ctx)
assert response.status_code == 200

View file

@ -5,7 +5,7 @@ import flask
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info):
def log_exception(self, ctx, exc_info):
pass
out = StringIO()