com.jimuwd.xian.registry-proxy 1.0.48 → 1.0.50
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 +2 -2
- package/package.json +1 -1
- package/src/index.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -199,7 +199,7 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, upstreamRes
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
res.writeHead(upstreamResponse.status,
|
|
202
|
+
res.writeHead(upstreamResponse.status, { "content-type": contentType }).end(JSON.stringify(data));
|
|
203
203
|
}
|
|
204
204
|
else {
|
|
205
205
|
// 二进制流处理
|
|
@@ -208,7 +208,7 @@ async function writeSuccessfulResponse(registryInfo, targetUrl, res, upstreamRes
|
|
|
208
208
|
res.writeHead(502).end('Empty Upstream Response');
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
211
|
-
res.writeHead(upstreamResponse.status, safeHeaders);
|
|
211
|
+
res.writeHead(upstreamResponse.status, /*safeHeaders*/ { connection: "keep-alive", "content-type": "application/octet-stream", "transfer-encoding": "chunked" });
|
|
212
212
|
upstreamResponse.body.pipe(res, { end: true });
|
|
213
213
|
}
|
|
214
214
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -266,14 +266,14 @@ async function writeSuccessfulResponse(
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
res.writeHead(upstreamResponse.status,
|
|
269
|
+
res.writeHead(upstreamResponse.status, {"content-type": contentType}).end(JSON.stringify(data));
|
|
270
270
|
} else {
|
|
271
271
|
// 二进制流处理
|
|
272
272
|
if (!upstreamResponse.body) {
|
|
273
273
|
console.error(`Empty response body from ${targetUrl}`);
|
|
274
274
|
res.writeHead(502).end('Empty Upstream Response');
|
|
275
275
|
} else {
|
|
276
|
-
res.writeHead(upstreamResponse.status, safeHeaders);
|
|
276
|
+
res.writeHead(upstreamResponse.status, /*safeHeaders*/{connection:"keep-alive","content-type":"application/octet-stream","transfer-encoding":"chunked"});
|
|
277
277
|
upstreamResponse.body.pipe(res, {end: true});
|
|
278
278
|
}
|
|
279
279
|
}
|