fix dev
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent 41cb747 · Browse files · 2 files·+33 added−36 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+33 added−36 removed
- tests:+2 added−2 removed
- other:+31 added−34 removed
Provenance
- Commit
329c32b- Tree
5878a5d- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
41cb747
2 files changed+33 added−36 removed
modified:src/flask/app.py+31 added-34 removed
14 unmodified lines15 from urllib.parse import urlsplit16 17 import click18 from werkzeug.datastructures import Headers19-from werkzeug.datastructures import ImmutableDict19 from werkzeug.exceptions import BadRequestKeyError20 from werkzeug.exceptions import HTTPException21 from werkzeug.exceptions import InternalServerError22 from werkzeug.routing import BuildError179 unmodified lines202 This should only be set manually when it can't be detected203 automatically, such as for namespace packages.204 """205 207- default_config = ImmutableDict(208- {209- "DEBUG": None,210- "TESTING": False,211- "PROPAGATE_EXCEPTIONS": None,212- "SECRET_KEY": None,213- "SECRET_KEY_FALLBACKS": None,214- "PERMANENT_SESSION_LIFETIME": timedelta(days=31),215- "USE_X_SENDFILE": False,216- "TRUSTED_HOSTS": None,217- "SERVER_NAME": None,218- "APPLICATION_ROOT": "/",219- "SESSION_COOKIE_NAME": "session",220- "SESSION_COOKIE_DOMAIN": None,221- "SESSION_COOKIE_PATH": None,222- "SESSION_COOKIE_HTTPONLY": True,223- "SESSION_COOKIE_SECURE": False,224- "SESSION_COOKIE_PARTITIONED": False,225- "SESSION_COOKIE_SAMESITE": None,226- "SESSION_REFRESH_EACH_REQUEST": True,227- "MAX_CONTENT_LENGTH": None,228- "MAX_FORM_MEMORY_SIZE": 500_000,229- "MAX_FORM_PARTS": 1_000,230- "SEND_FILE_MAX_AGE_DEFAULT": None,231- "TRAP_BAD_REQUEST_ERRORS": None,232- "TRAP_HTTP_EXCEPTIONS": False,233- "EXPLAIN_TEMPLATE_LOADING": False,234- "PREFERRED_URL_SCHEME": "http",235- "TEMPLATES_AUTO_RELOAD": None,236- "MAX_COOKIE_SIZE": 4093,237- "PROVIDE_AUTOMATIC_OPTIONS": True,238- }206+ default_config: cabc.Mapping[str, t.Any] = {207+ "DEBUG": None,208+ "TESTING": False,209+ "PROPAGATE_EXCEPTIONS": None,210+ "SECRET_KEY": None,211+ "SECRET_KEY_FALLBACKS": None,212+ "PERMANENT_SESSION_LIFETIME": timedelta(days=31),213+ "USE_X_SENDFILE": False,214+ "TRUSTED_HOSTS": None,215+ "SERVER_NAME": None,216+ "APPLICATION_ROOT": "/",217+ "SESSION_COOKIE_NAME": "session",218+ "SESSION_COOKIE_DOMAIN": None,219+ "SESSION_COOKIE_PATH": None,220+ "SESSION_COOKIE_HTTPONLY": True,221+ "SESSION_COOKIE_SECURE": False,222+ "SESSION_COOKIE_PARTITIONED": False,223+ "SESSION_COOKIE_SAMESITE": None,224+ "SESSION_REFRESH_EACH_REQUEST": True,225+ "MAX_CONTENT_LENGTH": None,226+ "MAX_FORM_MEMORY_SIZE": 500_000,227+ "MAX_FORM_PARTS": 1_000,228+ "SEND_FILE_MAX_AGE_DEFAULT": None,229+ "TRAP_BAD_REQUEST_ERRORS": None,230+ "TRAP_HTTP_EXCEPTIONS": False,231+ "EXPLAIN_TEMPLATE_LOADING": False,232+ "PREFERRED_URL_SCHEME": "http",233+ "TEMPLATES_AUTO_RELOAD": None,234+ "MAX_COOKIE_SIZE": 4093,235+ "PROVIDE_AUTOMATIC_OPTIONS": True,236+ }239- )237 238 #: The class that is used for request objects. See :class:`~flask.Request`239 #: for more information.240 request_class: type[Request] = Request1385 unmodified linesmodified:tests/test_testing.py+2 added-2 removed
41 unmodified lines42 def test_environ_base_default(app, client):43 @app.route("/")44 def index():45 flask.g.remote_addr = flask.request.remote_addr46- flask.g.user_agent = flask.request.user_agent.string46+ flask.g.user_agent = str(flask.request.user_agent)47 return ""48 49 with client:50 client.get("/")6 unmodified lines57 def test_environ_base_modified(app, client):58 @app.route("/")59 def index():60 flask.g.remote_addr = flask.request.remote_addr61- flask.g.user_agent = flask.request.user_agent.string61+ flask.g.user_agent = str(flask.request.user_agent)62 return ""63 64 client.environ_base["REMOTE_ADDR"] = "192.168.0.22"65 client.environ_base["HTTP_USER_AGENT"] = "Foo"333 unmodified lines