com.jimuwd.xian.registry-proxy 1.0.46 → 1.0.47

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
@@ -203,12 +203,12 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, response, r
203
203
  }
204
204
  else {
205
205
  // 二进制流处理
206
- res.writeHead(response.status, safeHeaders);
207
206
  if (!response.body) {
208
207
  console.error(`Empty response body from ${targetUrl}`);
208
+ res.writeHead(response.status, safeHeaders).end();
209
209
  }
210
210
  else {
211
- res.write(response.body, () => res.end());
211
+ res.writeHead(response.status, safeHeaders).end(response.body);
212
212
  /*await pipeline(response.body, res).finally(() => res.end());*/
213
213
  }
214
214
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
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
@@ -270,11 +270,11 @@ async function writeSuccessfulResponse(
270
270
  res.end(JSON.stringify(data));
271
271
  } else {
272
272
  // 二进制流处理
273
- res.writeHead(response.status, safeHeaders);
274
273
  if (!response.body) {
275
274
  console.error(`Empty response body from ${targetUrl}`);
275
+ res.writeHead(response.status, safeHeaders).end();
276
276
  } else {
277
- res.write(response.body, () => res.end())
277
+ res.writeHead(response.status, safeHeaders).end(response.body)
278
278
  /*await pipeline(response.body, res).finally(() => res.end());*/
279
279
  }
280
280
  }