@midwayjs/http-proxy 3.5.1 → 3.5.3

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.
@@ -2,6 +2,7 @@ export interface HttpProxyStrategy {
2
2
  match?: RegExp;
3
3
  host?: string;
4
4
  target?: string;
5
+ proxyTimeout?: number;
5
6
  ignoreHeaders?: {
6
7
  [key: string]: boolean;
7
8
  };
@@ -47,6 +47,7 @@ let HttpProxyMiddleware = class HttpProxyMiddleware {
47
47
  ? `${forwarded}, ${ctx.ip}`
48
48
  : ctx.ip;
49
49
  reqHeaders['host'] = url.host;
50
+ delete reqHeaders['content-length'];
50
51
  const method = req.method.toUpperCase();
51
52
  const targetRes = res.res || res;
52
53
  const isStream = targetRes.on && targetRes.writable;
@@ -55,6 +56,7 @@ let HttpProxyMiddleware = class HttpProxyMiddleware {
55
56
  url: url.href,
56
57
  headers: reqHeaders,
57
58
  responseType: isStream ? 'stream' : 'arrayBuffer',
59
+ timeout: this.httpProxy.proxyTimeout || 0,
58
60
  };
59
61
  if (method === 'POST' || method === 'PUT') {
60
62
  reqOptions.data = (_b = req.body) !== null && _b !== void 0 ? _b : (_c = ctx.request) === null || _c === void 0 ? void 0 : _c.body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/http-proxy",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "description": "Midway Component for http proxy",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -29,14 +29,14 @@
29
29
  "axios": "0.27.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@midwayjs/core": "^3.5.1",
32
+ "@midwayjs/core": "^3.5.3",
33
33
  "@midwayjs/decorator": "^3.4.11",
34
- "@midwayjs/express": "^3.5.1",
35
- "@midwayjs/faas": "^3.5.1",
36
- "@midwayjs/koa": "^3.5.1",
37
- "@midwayjs/mock": "^3.5.1",
38
- "@midwayjs/serverless-app": "^3.5.1",
39
- "@midwayjs/web": "^3.5.1"
34
+ "@midwayjs/express": "^3.5.3",
35
+ "@midwayjs/faas": "^3.5.3",
36
+ "@midwayjs/koa": "^3.5.3",
37
+ "@midwayjs/mock": "^3.5.3",
38
+ "@midwayjs/serverless-app": "^3.5.3",
39
+ "@midwayjs/web": "^3.5.3"
40
40
  },
41
- "gitHead": "3b63fc768617037644602dd5ad66d3734ce01b16"
41
+ "gitHead": "32356484664846984f6d3d65a3a75dea015e8dcc"
42
42
  }