ee-core 1.3.2 → 1.3.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.
package/config/config.default.js
CHANGED
package/lib/socket/httpServer.js
CHANGED
|
@@ -8,6 +8,7 @@ const koaBody = require('koa-body');
|
|
|
8
8
|
const https = require('https');
|
|
9
9
|
const fs = require('fs');
|
|
10
10
|
const path = require('path');
|
|
11
|
+
const _ = require('lodash');
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* http server
|
|
@@ -77,6 +78,7 @@ class HttpServer {
|
|
|
77
78
|
* 路由分发
|
|
78
79
|
*/
|
|
79
80
|
async dispatch (ctx, next) {
|
|
81
|
+
const config = ctx.eeApp.config.httpServer;
|
|
80
82
|
let uriPath = ctx.request.path;
|
|
81
83
|
const method = ctx.request.method;
|
|
82
84
|
let params = ctx.request.query;
|
|
@@ -96,6 +98,12 @@ class HttpServer {
|
|
|
96
98
|
if (uriPath.indexOf('/') == 0) {
|
|
97
99
|
uriPath = uriPath.substring(1);
|
|
98
100
|
}
|
|
101
|
+
// 过滤
|
|
102
|
+
if (_.includes(config.filterRequest.uris, uriPath)) {
|
|
103
|
+
ctx.response.body = config.filterRequest.returnData;
|
|
104
|
+
await next();
|
|
105
|
+
return
|
|
106
|
+
}
|
|
99
107
|
if (uriPath.slice(0, 10) != 'controller') {
|
|
100
108
|
uriPath = 'controller/' + uriPath;
|
|
101
109
|
}
|