From 33c5236a2db319979a279da06ad97a853a9b8615 Mon Sep 17 00:00:00 2001 From: architect-bot Date: Wed, 19 Aug 2026 13:25:05 +0000 Subject: [PATCH] WIP checkpoint: Architecture: ApiClient autoload (HTTP + JWT + error contract) --- scripts/api_client.gd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/api_client.gd b/scripts/api_client.gd index 793cc63..2f54bf7 100644 --- a/scripts/api_client.gd +++ b/scripts/api_client.gd @@ -172,16 +172,17 @@ func _on_http_request_completed( var detail: String = "" if response_code >= 200 and response_code < 300: - # Success — try to parse JSON. + # Success — try to parse JSON (works for both objects and arrays). var parse_result = JSON.parse_string(json_string) - if parse_result is Dictionary: + if parse_result is Dictionary or parse_result is Array: data = parse_result - # Extract backend detail if present. - if data.has("detail"): + # Extract backend detail if present (e.g. {"ok": true, "detail": "OK"}). + if data is Dictionary and data.has("detail"): detail = str(data["detail"]) else: detail = "OK" else: + # Not valid JSON — return raw string. data = json_string detail = "OK" else: