WIP checkpoint: Architecture: ApiClient autoload (HTTP + JWT + error contract)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user