WIP checkpoint: Architecture: ApiClient autoload (HTTP + JWT + error contract)

This commit is contained in:
2026-08-19 13:25:05 +00:00
parent 4bb4e9fb8a
commit 33c5236a2d
+5 -4
View File
@@ -172,16 +172,17 @@ func _on_http_request_completed(
var detail: String = "" var detail: String = ""
if response_code >= 200 and response_code < 300: 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) 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 data = parse_result
# Extract backend detail if present. # Extract backend detail if present (e.g. {"ok": true, "detail": "OK"}).
if data.has("detail"): if data is Dictionary and data.has("detail"):
detail = str(data["detail"]) detail = str(data["detail"])
else: else:
detail = "OK" detail = "OK"
else: else:
# Not valid JSON — return raw string.
data = json_string data = json_string
detail = "OK" detail = "OK"
else: else: