@midwayjs/express 3.1.7-alpha.0 → 3.2.2

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/framework.js CHANGED
@@ -54,6 +54,14 @@ let MidwayExpressFramework = class MidwayExpressFramework extends core_1.BaseFra
54
54
  debug('[express]: use user router middleware');
55
55
  // load controller,must apply router filter here
56
56
  const routerMiddlewares = await this.loadMidwayController();
57
+ if (this.mockService.getContextMocksSize() > 0) {
58
+ const mockMiddleware = (req, res, next) => {
59
+ this.mockService.applyContextMocks(this.app, req);
60
+ next();
61
+ };
62
+ this.app.use(mockMiddleware);
63
+ debug('[express]: use and apply mock framework');
64
+ }
57
65
  // use global middleware
58
66
  const globalMiddleware = await this.applyMiddleware();
59
67
  debug('[express]: use and apply all framework and global middleware');
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { IMidwayExpressConfigurationOptions } from './dist';
9
9
 
10
10
  export * from './dist/index';
11
11
 
12
- declare module '@midwayjs/core' {
12
+ declare module '@midwayjs/core/dist/interface' {
13
13
  interface MidwayConfig {
14
14
  express?: IMidwayExpressConfigurationOptions;
15
15
  cookieParser?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/express",
3
- "version": "3.1.7-alpha.0",
3
+ "version": "3.2.2",
4
4
  "description": "Midway Web Framework for Express",
5
5
  "main": "dist/index",
6
6
  "typings": "index.d.ts",
@@ -26,14 +26,14 @@
26
26
  "devDependencies": {
27
27
  "@midwayjs/decorator": "^3.1.6",
28
28
  "@midwayjs/logger": "^2.15.0",
29
- "@midwayjs/mock": "^3.1.7-alpha.0",
29
+ "@midwayjs/mock": "^3.2.2",
30
30
  "@types/body-parser": "1.19.2",
31
31
  "@types/express": "4.17.13",
32
32
  "fs-extra": "10.0.1"
33
33
  },
34
34
  "dependencies": {
35
- "@midwayjs/core": "^3.1.7-alpha.0",
36
- "@midwayjs/express-session": "^3.1.7-alpha.0",
35
+ "@midwayjs/core": "^3.2.2",
36
+ "@midwayjs/express-session": "^3.2.2",
37
37
  "body-parser": "1.19.2",
38
38
  "cookie-parser": "^1.4.6",
39
39
  "express": "4.17.3"
@@ -46,5 +46,5 @@
46
46
  "engines": {
47
47
  "node": ">=12"
48
48
  },
49
- "gitHead": "8cb6db25f7eb794d9c61aaf69a43ac6506a289b5"
49
+ "gitHead": "6bc097035302d01ae901d76a10e080db8554a864"
50
50
  }