gg-express 1.0.146 → 1.0.148
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/v3/GGExpressV3.js +12 -7
- package/package.json +1 -1
- package/src/v3/GGExpressV3.ts +19 -15
package/dist/v3/GGExpressV3.js
CHANGED
|
@@ -52,14 +52,19 @@ class GGExpressV3 {
|
|
|
52
52
|
// console.log("req.url", req.url)
|
|
53
53
|
// if (req.query) console.log("req.query", req.query)
|
|
54
54
|
// if (req.body) console.log("req.body", req.body)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
try {
|
|
56
|
+
if (method === "get" &&
|
|
57
|
+
isEmptyZodObject(options.requireParams.data) === false) {
|
|
58
|
+
options.requireParams.data.parse(autoCastBySchema(req.query.data, options.requireParams.data));
|
|
59
|
+
}
|
|
60
|
+
else if (method === "post" ||
|
|
61
|
+
method === "put" ||
|
|
62
|
+
method === "delete") {
|
|
63
|
+
options.requireParams.data.parse(autoCastBySchema(req.body.data.data, options.requireParams.data));
|
|
64
|
+
}
|
|
58
65
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
method === "delete") {
|
|
62
|
-
options.requireParams.data.parse(autoCastBySchema(req.body.data.data, options.requireParams.data));
|
|
66
|
+
catch (error) {
|
|
67
|
+
new Error(error);
|
|
63
68
|
}
|
|
64
69
|
next();
|
|
65
70
|
},
|
package/package.json
CHANGED
package/src/v3/GGExpressV3.ts
CHANGED
|
@@ -108,21 +108,25 @@ export default class GGExpressV3<
|
|
|
108
108
|
// console.log("req.url", req.url)
|
|
109
109
|
// if (req.query) console.log("req.query", req.query)
|
|
110
110
|
// if (req.body) console.log("req.body", req.body)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
try {
|
|
112
|
+
if (
|
|
113
|
+
method === "get" &&
|
|
114
|
+
isEmptyZodObject(options.requireParams.data) === false
|
|
115
|
+
) {
|
|
116
|
+
options.requireParams.data.parse(
|
|
117
|
+
autoCastBySchema(req.query.data, options.requireParams.data),
|
|
118
|
+
)
|
|
119
|
+
} else if (
|
|
120
|
+
method === "post" ||
|
|
121
|
+
method === "put" ||
|
|
122
|
+
method === "delete"
|
|
123
|
+
) {
|
|
124
|
+
options.requireParams.data.parse(
|
|
125
|
+
autoCastBySchema(req.body.data.data, options.requireParams.data),
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
new Error(error as any)
|
|
126
130
|
}
|
|
127
131
|
next()
|
|
128
132
|
},
|