midway-fatcms 0.0.1-beta.36 → 0.0.1-beta.38

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.
@@ -68,19 +68,20 @@ let ProxyApiService = class ProxyApiService extends ApiBaseService_1.ApiBaseServ
68
68
  try {
69
69
  const headers = {
70
70
  ...ctx.headers,
71
- host: targetUrl.host,
72
- 'content-length': ctx.get('content-length'),
71
+ host: targetUrl.host, // 设置正确的 host
73
72
  };
73
+ delete headers['content-length'];
74
74
  this.setRequestHeaders(headers, proxyApiEntity);
75
- const response = await (0, axios_1.default)({
75
+ const axiosParams = {
76
76
  method: ctx.method,
77
77
  url: targetUrl.toString(),
78
78
  data: ctx.request.body,
79
79
  headers: headers,
80
80
  responseType: response_type,
81
- timeout: proxyApiEntity.timeout_ms || 5 * 60 * 1000,
81
+ timeout: Number(proxyApiEntity.timeout_ms) || 5 * 60 * 1000,
82
82
  validateStatus: () => true,
83
- });
83
+ };
84
+ const response = await (0, axios_1.default)(axiosParams);
84
85
  ctx.status = response.status;
85
86
  const resHeaders = this.toResHeaders(response.headers);
86
87
  ctx.set({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midway-fatcms",
3
- "version": "0.0.1-beta.36",
3
+ "version": "0.0.1-beta.38",
4
4
  "description": "This is a midway component sample",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",