From 69630e73851c57428b64242a5ef0d592efa3c167 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 7 Jul 2023 06:06:42 -0600 Subject: [PATCH] Fix incorrect respnses (#7066) --- frigate/http.py | 66 ++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index ba62af047..fe5da869a 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -420,8 +420,8 @@ def get_labels(): else: events = Event.select(Event.label).distinct() except Exception as e: - return jsonify( - {"success": False, "message": f"Failed to get labels: {e}"}, "404" + return make_response( + jsonify({"success": False, "message": f"Failed to get labels: {e}"}), 404 ) labels = sorted([e.label for e in events]) @@ -435,8 +435,9 @@ def get_sub_labels(): try: events = Event.select(Event.sub_label).distinct() except Exception as e: - return jsonify( - {"success": False, "message": f"Failed to get sub_labels: {e}"}, "404" + return make_response( + jsonify({"success": False, "message": f"Failed to get sub_labels: {e}"}), + 404, ) sub_labels = [e.sub_label for e in events] @@ -869,12 +870,17 @@ def events(): @bp.route("/events//