From fcdee01608c9c19bc0969dc06a18b8fad0c14ae4 Mon Sep 17 00:00:00 2001 From: Para Dox Date: Sun, 1 Jun 2025 20:54:54 +0700 Subject: [PATCH] better error handling --- split-proxy/proxy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/split-proxy/proxy.js b/split-proxy/proxy.js index 2227abbb..d9b9eb92 100644 --- a/split-proxy/proxy.js +++ b/split-proxy/proxy.js @@ -252,8 +252,11 @@ class RPCProxy { // Capture and stream the response response.data.on('data', (chunk) => { + // Always capture data for comparison purposes + responseData += chunk.toString(); + + // Only write to client if still connected if (!isClientClosed() && !res.writableEnded) { - responseData += chunk.toString(); try { res.write(chunk); } catch (writeError) {