Skip to content

SOTA Open Source TTS

fix: correct wants_json to accept "application/json" format parameter (#1203)

huang yutongcea0efb75a8d
diff --git a/tools/server/api_utils.py b/tools/server/api_utils.py
index dcdcaf2..803bbbb 100644
--- a/tools/server/api_utils.py
+++ b/tools/server/api_utils.py
@@ -108,7 +108,7 @@ def wants_json(req):
"""
q = req.query_params.get("format", "").strip().lower()
if q in {"json", "application/json", "msgpack", "application/msgpack"}:
- return q == "json"
+ return q in ("json", "application/json")
accept = req.headers.get("Accept", "").strip().lower()
return "application/json" in accept and "application/msgpack" not in accept