ee-core 2.7.0-beta.9 → 2.7.1
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/jobs/child/forkProcess.js +1 -1
- package/package.json +1 -1
- package/ps/index.js +1 -1
- package/socket/httpServer.js +10 -6
package/package.json
CHANGED
package/ps/index.js
CHANGED
package/socket/httpServer.js
CHANGED
|
@@ -29,13 +29,13 @@ class HttpServer {
|
|
|
29
29
|
throw new Error('[ee-core] [socket/HttpServer] http port required, and must be a number !');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
this.
|
|
32
|
+
this._create();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* 创建服务
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
_create () {
|
|
39
39
|
const app = this.app;
|
|
40
40
|
const httpServer = this.options;
|
|
41
41
|
const isHttps = httpServer?.https?.enable ?? false;
|
|
@@ -62,7 +62,7 @@ class HttpServer {
|
|
|
62
62
|
ctx.eeApp = app;
|
|
63
63
|
await next();
|
|
64
64
|
})
|
|
65
|
-
.use(this.
|
|
65
|
+
.use(this._dispatch);
|
|
66
66
|
|
|
67
67
|
let msg = '[ee-core] [socket/http] server is: ' + url;
|
|
68
68
|
|
|
@@ -86,13 +86,14 @@ class HttpServer {
|
|
|
86
86
|
/**
|
|
87
87
|
* 路由分发
|
|
88
88
|
*/
|
|
89
|
-
async
|
|
89
|
+
async _dispatch (ctx, next) {
|
|
90
90
|
const config = ctx.eeApp.config.httpServer;
|
|
91
91
|
let uriPath = ctx.request.path;
|
|
92
92
|
const method = ctx.request.method;
|
|
93
93
|
let params = ctx.request.query;
|
|
94
94
|
params = is.object(params) ? JSON.parse(JSON.stringify(params)) : {};
|
|
95
95
|
const body = ctx.request.body;
|
|
96
|
+
const files = ctx.request.files;
|
|
96
97
|
|
|
97
98
|
// 默认
|
|
98
99
|
ctx.response.status = 200;
|
|
@@ -117,7 +118,10 @@ class HttpServer {
|
|
|
117
118
|
uriPath = 'controller/' + uriPath;
|
|
118
119
|
}
|
|
119
120
|
const cmd = uriPath.split('/').join('.');
|
|
120
|
-
const args = (method == 'POST') ? body : params;
|
|
121
|
+
const args = (method == 'POST') ? (ctx.request.header['content-type'] && ctx.request.header['content-type'].startsWith('multipart/form-data;') ? files : body) : params;
|
|
122
|
+
args.files = ctx.request.files;
|
|
123
|
+
args.body = ctx.request.body;
|
|
124
|
+
args.query = ctx.request.query;
|
|
121
125
|
let fn = null;
|
|
122
126
|
if (is.string(cmd)) {
|
|
123
127
|
const actions = cmd.split('.');
|
|
@@ -140,4 +144,4 @@ class HttpServer {
|
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
module.exports = HttpServer;
|
|
147
|
+
module.exports = HttpServer;
|