spreadlab/internal/api
Justin Visser 2feb6ea5a3 api: keep the error contract JSON even on encoder failure
writeJSON's last-resort branch (json.Marshal failing, a programmer
error: unsupported type or cyclic data) previously fell back to
http.Error, which answers text/plain and was the one corner where the
API broke its own {"error": ...} contract. It now writes a
hand-written constant JSON literal: still strictly simpler than the
encoder that just failed (the reason writeError, which is built ON
writeJSON, cannot be used there: it would be circular), but contract
consistent. Tested by forcing the branch with a channel payload,
which json.Marshal cannot encode.
2026-06-10 16:22:35 +02:00
..
api.go api: keep the error contract JSON even on encoder failure 2026-06-10 16:22:35 +02:00
api_test.go api: keep the error contract JSON even on encoder failure 2026-06-10 16:22:35 +02:00
scenario_test.go api: POST /api/scenario returns result plus graph topology (M3 slice 1) 2026-06-10 15:48:48 +02:00