Fix a bug where some NaN values could leak into the JSON output, causing it to be invalid. Created a new safe_json_dumps method since we would otherwise now be providing multiple parameters all over the code

This commit is contained in:
Ian Renton
2026-06-28 18:09:44 +01:00
parent 72f367f607
commit b09108b41b
16 changed files with 66 additions and 78 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
import json
from datetime import datetime
from typing import Any
@@ -10,7 +9,7 @@ from tornado.web import Application
from core.config import MAX_SPOT_AGE, ALLOW_SPOTTING
from core.constants import BANDS, ALL_MODES, MODE_TYPES, SIGS, CONTINENTS, PROPAGATION_MODES
from core.prometheus_metrics_handler import api_requests_counter
from core.utils import serialize_everything
from core.utils import safe_json_dumps
class APIOptionsHandler(tornado.web.RequestHandler):
@@ -50,7 +49,7 @@ class APIOptionsHandler(tornado.web.RequestHandler):
if ALLOW_SPOTTING:
options["spot_sources"].append("API")
self.write(json.dumps(options, default=serialize_everything))
self.write(safe_json_dumps(options))
self.set_status(200)
self.set_header("Cache-Control", "no-store")
self.set_header("Content-Type", "application/json")