webhookdrop-tunnel 1.0.0 → 1.0.1
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/bin/tunnel.js +10 -4
- package/package.json +1 -1
package/bin/tunnel.js
CHANGED
|
@@ -113,20 +113,26 @@ async function forwardRequest(data) {
|
|
|
113
113
|
method: method,
|
|
114
114
|
headers: {
|
|
115
115
|
...headers,
|
|
116
|
-
'host': targetUrl.host
|
|
116
|
+
'host': targetUrl.host,
|
|
117
|
+
// Request uncompressed content to avoid encoding issues
|
|
118
|
+
'accept-encoding': 'identity'
|
|
117
119
|
},
|
|
118
120
|
timeout: 30000
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
const req = httpModule.request(requestOptions, (res) => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
// Collect response as Buffer chunks to handle binary data correctly
|
|
125
|
+
const chunks = [];
|
|
126
|
+
res.on('data', (chunk) => chunks.push(chunk));
|
|
124
127
|
res.on('end', () => {
|
|
128
|
+
const buffer = Buffer.concat(chunks);
|
|
125
129
|
resolve({
|
|
126
130
|
success: true,
|
|
127
131
|
status_code: res.statusCode,
|
|
128
132
|
headers: res.headers,
|
|
129
|
-
|
|
133
|
+
// Send as base64 to preserve binary data
|
|
134
|
+
body: buffer.toString('base64'),
|
|
135
|
+
body_encoding: 'base64'
|
|
130
136
|
});
|
|
131
137
|
});
|
|
132
138
|
});
|