com.jimuwd.xian.registry-proxy 1.0.42 → 1.0.44

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 CHANGED
@@ -175,7 +175,8 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, response, r
175
175
  // 复制所有可能需要的头信息
176
176
  const headersToCopy = [
177
177
  'cache-control', 'etag', 'last-modified',
178
- 'content-encoding', 'content-length'
178
+ 'content-encoding', 'content-length',
179
+ 'transfer-encoding', "collection"
179
180
  ];
180
181
  headersToCopy.forEach(header => {
181
182
  const value = response.headers.get(header);
@@ -208,7 +209,7 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, response, r
208
209
  console.error(`Empty response body from ${targetUrl}`);
209
210
  }
210
211
  else {
211
- await pipeline(response.body, res);
212
+ await pipeline(response.body, res).finally(() => res.end());
212
213
  }
213
214
  }
214
215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "type": "module",
5
5
  "description": "A lightweight npm registry proxy with fallback support",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -240,7 +240,8 @@ async function writeSuccessfulResponse(
240
240
  // 复制所有可能需要的头信息
241
241
  const headersToCopy = [
242
242
  'cache-control', 'etag', 'last-modified',
243
- 'content-encoding', 'content-length'
243
+ 'content-encoding', 'content-length',
244
+ 'transfer-encoding', "collection"
244
245
  ];
245
246
 
246
247
  headersToCopy.forEach(header => {
@@ -273,7 +274,7 @@ async function writeSuccessfulResponse(
273
274
  if (!response.body) {
274
275
  console.error(`Empty response body from ${targetUrl}`);
275
276
  } else {
276
- await pipeline(response.body, res);
277
+ await pipeline(response.body, res).finally(() => res.end());
277
278
  }
278
279
  }
279
280
  } catch (err) {