From 0d794bd9f65bb434a8c39e1aabf53730a4a08524 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 04:26:10 +0000 Subject: [PATCH] Set content type to `application/json` for `flask.make_response` with JSON data --- .../d_using_flask/a_simple_apps/c_json_reponse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/c_json_reponse.py b/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/c_json_reponse.py index 85d4b6ca..2e101fa3 100644 --- a/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/c_json_reponse.py +++ b/python3/16_Web_Services/f_web_application/d_using_flask/a_simple_apps/c_json_reponse.py @@ -28,7 +28,7 @@ def json_example(): data = {"key": "value"} json_data = json.dumps(data) - response = make_response(json_data) + response = make_response(json_data, {'Content-Type': 'application/json'}) response.mimetype = "application/json" return response