diff --git a/CHANGES b/CHANGES index 7280e469..207da344 100644 --- a/CHANGES +++ b/CHANGES @@ -96,6 +96,9 @@ Major release, unreleased - ``Flask.static_path`` - use ``Flask.static_url_path`` instead. - ``Request.module`` - use ``Request.blueprint`` instead. +- The ``request.json`` property is no longer deprecated. (`#1421`_) + +.. _#1421: https://github.com/pallets/flask/issues/1421 .. _#1489: https://github.com/pallets/flask/pull/1489 .. _#1621: https://github.com/pallets/flask/pull/1621 .. _#1898: https://github.com/pallets/flask/pull/1898 diff --git a/flask/wrappers.py b/flask/wrappers.py index 4dde5f3c..8c559c0e 100644 --- a/flask/wrappers.py +++ b/flask/wrappers.py @@ -8,8 +8,6 @@ :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ -from warnings import warn - from werkzeug.exceptions import BadRequest from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase @@ -44,13 +42,7 @@ class JSONMixin(object): """This will contain the parsed JSON data if the mimetype indicates JSON (:mimetype:`application/json`, see :meth:`is_json`), otherwise it will be ``None``. - - .. deprecated:: 1.0 - Use :meth:`get_json` instead. """ - warn(DeprecationWarning( - "'json' is deprecated. Use 'get_json()' instead." - ), stacklevel=2) return self.get_json() def _get_data_for_json(self, cache): diff --git a/tests/test_deprecations.py b/tests/test_deprecations.py deleted file mode 100644 index 5dfff127..00000000 --- a/tests/test_deprecations.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -""" - tests.deprecations - ~~~~~~~~~~~~~~~~~~ - - Tests deprecation support. Not used currently. - - :copyright: (c) 2015 by Armin Ronacher. - :license: BSD, see LICENSE for more details. -""" - -import flask - - -class TestRequestDeprecation(object): - def test_request_json(self, recwarn, app, client): - """Request.json is deprecated""" - - @app.route('/', methods=['POST']) - def index(): - assert flask.request.json == {'spam': 42} - print(flask.request.json) - return 'OK' - - client.post('/', data='{"spam": 42}', content_type='application/json') - recwarn.pop(DeprecationWarning)