@konplit-services/common 1.0.123 → 1.0.124
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.
|
@@ -18,10 +18,9 @@ const validAllowedFields = (allowFields) => {
|
|
|
18
18
|
const params = Object.keys(req.params);
|
|
19
19
|
const query = Object.keys(req.query);
|
|
20
20
|
const body = Object.keys(req.body);
|
|
21
|
-
const submittedFields = [
|
|
22
|
-
|
|
23
|
-
...
|
|
24
|
-
...body,
|
|
21
|
+
const submittedFields = [...params, ...query, ...body];
|
|
22
|
+
const newAllowedFields = [
|
|
23
|
+
...allowFields,
|
|
25
24
|
"search",
|
|
26
25
|
"page",
|
|
27
26
|
"limit",
|
|
@@ -30,7 +29,7 @@ const validAllowedFields = (allowFields) => {
|
|
|
30
29
|
"sort_by",
|
|
31
30
|
"order",
|
|
32
31
|
];
|
|
33
|
-
const extraFields = submittedFields.filter((field) => !
|
|
32
|
+
const extraFields = submittedFields.filter((field) => !newAllowedFields.includes(field));
|
|
34
33
|
if (extraFields.length > 0) {
|
|
35
34
|
throw new errors_1.BadRequestError(`Extra fields submitted: ${extraFields.join(", ")}`, error_codes_1.error_codes.INVALID_INPUT);
|
|
36
35
|
}
|