com.jimuwd.xian.registry-proxy 1.0.101 → 1.0.103
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/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -226,7 +226,7 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
|
|
|
226
226
|
const cleanup = () => {
|
|
227
227
|
reqFromDownstreamClient.off('close', cleanup);
|
|
228
228
|
logger.info(`Req from downstream client is closed, stop pipe from upstream ${targetUrl} to downstream client.`);
|
|
229
|
-
upstreamResponse.body?.unpipe();
|
|
229
|
+
// upstreamResponse.body?.unpipe();
|
|
230
230
|
};
|
|
231
231
|
reqFromDownstreamClient.on('close', cleanup);
|
|
232
232
|
reqFromDownstreamClient.on('end', () => logger.info("Req from downstream client ends."));
|
|
@@ -234,17 +234,17 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
|
|
|
234
234
|
const cleanup0 = () => {
|
|
235
235
|
resToDownstreamClient.off('close', cleanup0);
|
|
236
236
|
logger.info(`Close connection to downstream client, upstream url is ${targetUrl}`);
|
|
237
|
-
upstreamResponse.body?.unpipe();
|
|
237
|
+
// upstreamResponse.body?.unpipe();
|
|
238
238
|
};
|
|
239
239
|
resToDownstreamClient.on('close', cleanup0);
|
|
240
240
|
// write back body data (chunked probably)
|
|
241
241
|
// pipe upstream body to downstream client
|
|
242
|
-
upstreamResponse.body.pipe(resToDownstreamClient, { end:
|
|
242
|
+
upstreamResponse.body.pipe(resToDownstreamClient, { end: true });
|
|
243
243
|
upstreamResponse.body
|
|
244
244
|
.on('data', (chunk) => logger.info(`Chunk transferred from ${targetUrl} to downstream client size=${chunk.length}`))
|
|
245
245
|
.on('end', () => {
|
|
246
246
|
logger.info(`Upstream server ${targetUrl} response.body ended.`);
|
|
247
|
-
resToDownstreamClient.end();
|
|
247
|
+
// resToDownstreamClient.end();
|
|
248
248
|
})
|
|
249
249
|
// connection will be closed automatically when all chunk data is transferred (after stream ends).
|
|
250
250
|
.on('close', () => {
|