@midwayjs/web 3.0.5 → 3.0.6

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.
@@ -21,7 +21,10 @@ let EggConfiguration = class EggConfiguration {
21
21
  async onReady() {
22
22
  // ps: 本想在这里清理掉egg添加的中间件,但是这里的数组已经只有一个 midway root middleware,其他的 getter 都是 egg 加进去的,但是不会被中间件执行,所以不需要清理
23
23
  // 去掉为了 egg-socket.io 报错扫进去的 session
24
- this.app.middleware = this.app.middleware.slice(0);
24
+ this.app.middleware =
25
+ Array.isArray(this.app.middleware) && this.app.middleware.length
26
+ ? this.app.middleware.slice()
27
+ : [];
25
28
  }
26
29
  async onServerReady() {
27
30
  // trigger server didReady
@@ -75,8 +75,8 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
75
75
  // not found middleware
76
76
  const notFound = async (ctx, next) => {
77
77
  await next();
78
- if (!ctx._matchedRoute) {
79
- throw new core_1.httpError.NotFoundError();
78
+ if (!ctx._matchedRoute && ctx.body === undefined) {
79
+ throw new core_1.httpError.NotFoundError(`${ctx.path} Not Found`);
80
80
  }
81
81
  };
82
82
  // insert error handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/web",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/decorator": "^3.0.4",
30
+ "@midwayjs/decorator": "^3.0.6",
31
31
  "@midwayjs/logger": "^2.15.0",
32
- "@midwayjs/mock": "^3.0.5",
32
+ "@midwayjs/mock": "^3.0.6",
33
33
  "axios": "^0.25.0",
34
34
  "dayjs": "1.10.7",
35
35
  "egg-logger": "2.7.1",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@eggjs/router": "^2.0.0",
49
- "@midwayjs/core": "^3.0.4",
49
+ "@midwayjs/core": "^3.0.6",
50
50
  "egg": "^2.28.0",
51
51
  "find-up": "5.0.0",
52
52
  "mkdirp": "^1.0.4"
@@ -59,5 +59,5 @@
59
59
  "engines": {
60
60
  "node": ">=12"
61
61
  },
62
- "gitHead": "9b17898f10faeef2e7f1011eaea67f1d0b085261"
62
+ "gitHead": "afaa5b59a2be85e915233a9268c0e05965dd5c61"
63
63
  }