hono 2.3.0 → 2.3.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.
|
@@ -37,6 +37,15 @@ const validatorMiddleware = (validationFunction, options) => {
|
|
|
37
37
|
}
|
|
38
38
|
resultSet.results.push(result);
|
|
39
39
|
}
|
|
40
|
+
// If it's invalid but it has no "value" messages, have to set the "type" messages.
|
|
41
|
+
// This approach is verbose, but if do not so, the response body will be empty.
|
|
42
|
+
if (!isValid && resultSet.messages.length === 0) {
|
|
43
|
+
resultSet.results.map((r) => {
|
|
44
|
+
if (!r.isValid && r.ruleType === 'type' && r.message) {
|
|
45
|
+
resultSet.messages.push(r.message);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
40
49
|
// Set data on request object
|
|
41
50
|
if (isValid) {
|
|
42
51
|
// Set data on request object
|
|
@@ -34,6 +34,15 @@ export const validatorMiddleware = (validationFunction, options) => {
|
|
|
34
34
|
}
|
|
35
35
|
resultSet.results.push(result);
|
|
36
36
|
}
|
|
37
|
+
// If it's invalid but it has no "value" messages, have to set the "type" messages.
|
|
38
|
+
// This approach is verbose, but if do not so, the response body will be empty.
|
|
39
|
+
if (!isValid && resultSet.messages.length === 0) {
|
|
40
|
+
resultSet.results.map((r) => {
|
|
41
|
+
if (!r.isValid && r.ruleType === 'type' && r.message) {
|
|
42
|
+
resultSet.messages.push(r.message);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
37
46
|
// Set data on request object
|
|
38
47
|
if (isValid) {
|
|
39
48
|
// Set data on request object
|