Skip to content
Myr

Merge branch 'stable'

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 · parents 809d5a8, 5559ef4 · Browse files · 6 files+19 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+19 added−8 removed

  • other:+19 added−8 removed

6 files+19 added−8 removed

modified:docs/patterns/javascript.rst+5 added-3 removed
134 unmodified lines
135In general, prefer sending request data as form data, as would be used136when submitting an HTML form. JSON can represent more complex data, but137unless you need that it's better to stick with the simpler format. When138sending JSON data, the ``Content-Type: application/json`` header must be139sent as well, otherwise Flask will return a 400 error.139sent as well, otherwise Flask will return a 415 Unsupported Media Type140error.141142.. code-block:: javascript143144 let data = {
99 unmodified lines
244-----------------------245246Use the :attr:`~flask.Request.json` property of the247:data:`~flask.request` object to decode the request's body as JSON. If247the body is not valid JSON, or the ``Content-Type`` header is not set to248``application/json``, a 400 Bad Request error will be raised.248the body is not valid JSON, a 400 Bad Request error will be raised. If249the ``Content-Type`` header is not set to ``application/json``, a 415250Unsupported Media Type error will be raised.251252.. code-block:: python253254 from flask import request
7 unmodified lines
modified:src/flask/sansio/app.py+1 added-1 removed
528 unmodified lines
529 .. versionadded:: 0.7530 """531 return DispatchingJinjaLoader(self)532533 def select_jinja_autoescape(self, filename: str) -> bool:533 def select_jinja_autoescape(self, filename: str | None) -> bool:534 """Returns ``True`` if autoescaping should be active for the given535 template name. If no template name is given, returns `True`.536537 .. versionchanged:: 2.2
472 unmodified lines
modified:src/flask/app.py+2 added-2 removed
356 unmodified lines
357 self.add_url_rule(358 f"{self.static_url_path}/<path:filename>",359 endpoint="static",360 host=static_host,361 view_func=lambda **kw: self_ref().send_static_file(**kw), # type: ignore # noqa: B950361 view_func=lambda **kw: self_ref().send_static_file(**kw), # type: ignore362 )363364 def get_send_file_max_age(self, filename: str | None) -> int | None:365 """Used by :func:`send_file` to determine the ``max_age`` cache
1201 unmodified lines
1567 response = self.full_dispatch_request(ctx)1568 except Exception as e:1569 error = e1570 response = self.handle_exception(ctx, e)1571 except: # noqa: B0011571 except:1572 error = sys.exc_info()[1]1573 raise1574 return response(environ, start_response)1575 finally:
16 unmodified lines
modified:src/flask/sessions.py+1 added-1 removed
105 unmodified lines
106 "key was set. Set the secret_key on the "107 "application to something unique and secret."108 )109110 __setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail # noqa: B950110 __setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail111 del _fail112113114class SessionInterface:
285 unmodified lines
modified:.pre-commit-config.yaml+7 added-1 removed
modified:pyproject.toml+3 added
166 unmodified lines
167[tool.ruff.lint.isort]168force-single-line = true169order-by-type = false170171[tool.codespell]172ignore-words-list = "te"173174[tool.tox]175env_list = [176 "py3.14", "py3.14t",177 "py3.13", "py3.12", "py3.11", "py3.10",
104 unmodified lines