Flask_Movie_Website icon indicating copy to clipboard operation
Flask_Movie_Website copied to clipboard

replacing json.dumps with flask jsonify helper wrapper

Open daghan opened this issue 5 years ago • 0 comments

Hi Henry,

We have a free program analysis tool for Python based web projects, called Bento. While we were scanning GitHub projects for issues, your project triggered a warning for using json.dumps() instead of flask jsonify().

According to this Stackoverflow article (https://stackoverflow.com/questions/7907596/json-dumps-vs-flask-jsonify), the jsonify() function in flask returns a flask.Response() object that already has the appropriate content-type header 'application/json' for use with json responses. It also has support for handling multiple args / kwargs, including lists. Hopefully, you'll find this PR useful.

Bento flagged few other issues related to Python3 compatibility, but I didn't want to touch those issues in this PR. If you are interested, feel free download and give Bento a try (https://bento.dev).

daghan avatar Jan 02 '20 20:01 daghan