flask-jsonschema icon indicating copy to clipboard operation
flask-jsonschema copied to clipboard

Should use request.get_json(silent=True)

Open lanecm opened this issue 10 years ago • 2 comments

On line 59, I think it would be better to use:

request.get_json(silent=True)

instead of:

request.json

Then you won't get those The browser (or proxy) sent a request that this server could not understand errors.

lanecm avatar Sep 24 '14 17:09 lanecm

.json is now deprecated and raises a warning. See http://flask.pocoo.org/docs/0.11/changelog/:

Deprecated request.json in favour of request.get_json().

adamtheturtle avatar May 30 '16 12:05 adamtheturtle

I find that if I use

request.get_json(silent=True)

I will get None, but if I use

request.get_json()

I will get the right data.

kingname avatar Oct 25 '16 03:10 kingname