@jayfong/x-server 2.52.1 → 2.52.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/lib/_cjs/core/handler.js +4 -1
- package/lib/core/handler.js +4 -1
- package/lib/core/types.d.ts +4 -0
- package/package.json +1 -1
package/lib/_cjs/core/handler.js
CHANGED
|
@@ -31,6 +31,10 @@ class Handler {
|
|
|
31
31
|
return this.handleHttp(data, ctx);
|
|
32
32
|
};
|
|
33
33
|
this.handleHttp = async (data, ctx) => {
|
|
34
|
+
// 请求数据解析
|
|
35
|
+
if (this.options.parseRequestData) {
|
|
36
|
+
data = await this.options.parseRequestData(data, ctx);
|
|
37
|
+
}
|
|
34
38
|
// 请求数据验证
|
|
35
39
|
// vae
|
|
36
40
|
if (this.requestDataSchemaVae) {
|
|
@@ -45,7 +49,6 @@ class Handler {
|
|
|
45
49
|
data = res.data;
|
|
46
50
|
} else {
|
|
47
51
|
throw new _http_error.HttpError.BadRequest(
|
|
48
|
-
// TODO: 暂时兼容编译bug
|
|
49
52
|
// @ts-ignore
|
|
50
53
|
res.issues[0].message);
|
|
51
54
|
}
|
package/lib/core/handler.js
CHANGED
|
@@ -25,6 +25,10 @@ export class Handler {
|
|
|
25
25
|
return this.handleHttp(data, ctx);
|
|
26
26
|
};
|
|
27
27
|
this.handleHttp = async (data, ctx) => {
|
|
28
|
+
// 请求数据解析
|
|
29
|
+
if (this.options.parseRequestData) {
|
|
30
|
+
data = await this.options.parseRequestData(data, ctx);
|
|
31
|
+
}
|
|
28
32
|
// 请求数据验证
|
|
29
33
|
// vae
|
|
30
34
|
if (this.requestDataSchemaVae) {
|
|
@@ -39,7 +43,6 @@ export class Handler {
|
|
|
39
43
|
data = res.data;
|
|
40
44
|
} else {
|
|
41
45
|
throw new HttpError.BadRequest(
|
|
42
|
-
// TODO: 暂时兼容编译bug
|
|
43
46
|
// @ts-ignore
|
|
44
47
|
res.issues[0].message);
|
|
45
48
|
}
|
package/lib/core/types.d.ts
CHANGED