@dainprotocol/tunnel 1.1.2 → 1.1.3

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.
@@ -257,7 +257,7 @@ class DainTunnel extends events_1.EventEmitter {
257
257
  hostname: 'localhost',
258
258
  port: this.port,
259
259
  path: message.path,
260
- method: 'GET',
260
+ method: message.method || 'GET', // Use provided method (supports POST tool calls)
261
261
  headers: message.headers,
262
262
  };
263
263
  const req = http_1.default.request(options, (res) => {
@@ -329,6 +329,10 @@ class DainTunnel extends events_1.EventEmitter {
329
329
  }));
330
330
  }
331
331
  });
332
+ // Write request body for POST requests
333
+ if (message.body && message.method !== 'GET') {
334
+ req.write(Buffer.from(message.body, 'base64'));
335
+ }
332
336
  req.end();
333
337
  // Store a reference to abort the connection later if needed
334
338
  this.sseClients.set(message.id, req);
@@ -412,7 +412,9 @@ class DainTunnelServer {
412
412
  type: "sse_connection",
413
413
  id: sseId,
414
414
  path: req.url,
415
- headers: req.headers
415
+ method: req.method, // Include HTTP method for POST tool calls
416
+ headers: req.headers,
417
+ body: req.method !== "GET" && req.body ? req.body.toString("base64") : undefined
416
418
  }));
417
419
  // Handle client disconnect
418
420
  req.on('close', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/tunnel",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "private": false,