claude-simple 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -93,10 +93,16 @@ function connect() {
93
93
  delete reqHeaders['Accept-Encoding'];
94
94
  reqHeaders['Accept-Encoding'] = 'identity';
95
95
 
96
+ // Hub may send binary request bodies as base64 (image/file uploads).
97
+ // Without decoding, Node fetch would write the base64 text to disk.
98
+ let reqBody = msg.body || undefined;
99
+ if (reqBody != null && reqBody !== '' && String(msg.encoding || '').toLowerCase() === 'base64') {
100
+ reqBody = Buffer.from(reqBody, 'base64');
101
+ }
96
102
  const res = await fetch(url, {
97
103
  method: msg.method,
98
104
  headers: reqHeaders,
99
- body: msg.body || undefined,
105
+ body: reqBody,
100
106
  });
101
107
  const headers = sanitizeProxyHeaders(Object.fromEntries(res.headers.entries()));
102
108
  const contentType = res.headers.get('content-type') || '';