From 23ccc799aab7880309d9990909e3223921aa00bb Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Fri, 10 Jul 2026 10:20:26 -0500 Subject: [PATCH] fix(client): parse HttpTransport body via JSON.new() not parse_string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whole-branch review Minor #1: JSON.parse_string pushes an engine-level error on a non-JSON body (e.g. a gateway HTML 502), which the project's gutconfig promotes to a false failure — the same reason FallbackLibrary already avoids it. Consistency fix; a non-JSON body still degrades. Co-Authored-By: Claude Opus 4.8 (1M context) --- client/scripts/net/http_transport.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/scripts/net/http_transport.gd b/client/scripts/net/http_transport.gd index 2b53f65..dbd768c 100644 --- a/client/scripts/net/http_transport.gd +++ b/client/scripts/net/http_transport.gd @@ -31,5 +31,10 @@ func post_json(path: String, body: Dictionary) -> DmResponse: var raw: PackedByteArray = signal_args[3] if result != HTTPRequest.RESULT_SUCCESS: return DmResponse.failed("transport result %d" % result) - var parsed = JSON.parse_string(raw.get_string_from_utf8()) # null if not JSON + # Parse via JSON.new() rather than JSON.parse_string(): the latter pushes an + # engine-level error on a non-JSON body (e.g. a gateway's HTML 502), which the + # project's gutconfig promotes to a false test failure. A non-JSON body stays + # null here — the service treats a non-dict body as a failure and degrades. + var json := JSON.new() + var parsed = null if json.parse(raw.get_string_from_utf8()) != OK else json.data return DmResponse.ok(response_code, parsed)