com.jimuwd.xian.registry-proxy 1.0.27 → 1.0.28
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/src/index.ts +3 -4
package/dist/index.js
CHANGED
|
@@ -214,10 +214,10 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
|
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
const contentLength = successResponse.headers.get('Content-Length');
|
|
217
|
-
const safeHeaders = {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
const safeHeaders = {};
|
|
218
|
+
safeHeaders["content-type"] = contentType;
|
|
219
|
+
if (contentLength && !isNaN(Number(contentLength)))
|
|
220
|
+
safeHeaders["content-length"] = contentLength;
|
|
221
221
|
res.writeHead(successResponse.status, safeHeaders);
|
|
222
222
|
successResponse.body.pipe(res).on('error', (err) => {
|
|
223
223
|
console.error(`Stream error for ${relativePathPrefixedWithSlash}:`, err);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -266,10 +266,9 @@ export async function startProxyServer(
|
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
268
|
const contentLength = successResponse.headers.get('Content-Length');
|
|
269
|
-
const safeHeaders: OutgoingHttpHeaders = {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
};
|
|
269
|
+
const safeHeaders: OutgoingHttpHeaders = {};
|
|
270
|
+
safeHeaders["content-type"] = contentType;
|
|
271
|
+
if (contentLength && !isNaN(Number(contentLength))) safeHeaders["content-length"] = contentLength;
|
|
273
272
|
res.writeHead(successResponse.status, safeHeaders);
|
|
274
273
|
successResponse.body.pipe(res).on('error', (err: any) => {
|
|
275
274
|
console.error(`Stream error for ${relativePathPrefixedWithSlash}:`, err);
|