Flask Request.json() is deprecated, use get_json() instead.

See http://flask.pocoo.org/docs/0.12/api/#flask.Request.json
This commit is contained in:
Sybren A. Stüvel 2017-06-02 16:03:45 +02:00
parent 3e67db50f0
commit 6f16e20bf6

View File

@ -456,12 +456,13 @@ class AbstractPillarTest(TestMinimal):
expected_status, resp.status_code, resp.data
))
def json():
def get_json():
if resp.mimetype != 'application/json':
raise TypeError('Unable to load JSON from mimetype %r' % resp.mimetype)
return mod_json.loads(resp.data)
resp.json = json
resp.json = get_json
resp.get_json = get_json
return resp