xzwebx-httpfilter 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. package/HttpFilter.js +21 -0
  2. package/package.json +1 -1
package/HttpFilter.js CHANGED
@@ -198,11 +198,17 @@ function IsStringOk(fCfgItem, paramValue) {
198
198
  }
199
199
 
200
200
  if (!isPass) {
201
+ if (rule.ruleDesc) {
202
+ return rule.ruleDesc
203
+ }
201
204
  return ['WRONG_STR_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
202
205
  }
203
206
  } else if (rule.checkType == 'ENU') {
204
207
  if (rule.isCaseSensitive == 1) {
205
208
  if (rule.exprVal && rule.exprVal.length && !rule.exprVal.includes(paramValue)) {
209
+ if (rule.ruleDesc) {
210
+ return rule.ruleDesc
211
+ }
206
212
  return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
207
213
  }
208
214
  } else {
@@ -214,6 +220,9 @@ function IsStringOk(fCfgItem, paramValue) {
214
220
  }
215
221
  }
216
222
  if (!isPass) {
223
+ if (rule.ruleDesc) {
224
+ return rule.ruleDesc
225
+ }
217
226
  return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
218
227
  }
219
228
  }
@@ -236,6 +245,9 @@ function IsStringOk(fCfgItem, paramValue) {
236
245
  }
237
246
  }
238
247
  if (!isPass) {
248
+ if (rule.ruleDesc) {
249
+ return rule.ruleDesc
250
+ }
239
251
  return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
240
252
  }
241
253
  }
@@ -270,10 +282,16 @@ function IsIntOk(fCfgItem, paramValue) {
270
282
  }
271
283
 
272
284
  if (!isPass) {
285
+ if (rule.ruleDesc) {
286
+ return rule.ruleDesc
287
+ }
273
288
  return ['WRONG_INT_RANGE', fCfgItem.fieldUrl, JSON.stringify(rule.exprVal)]
274
289
  }
275
290
  } else if (rule.checkType == 'ENU') {
276
291
  if (rule.exprVal && rule.exprVal.length && !rule.exprVal.includes(paramValue)) {
292
+ if (rule.ruleDesc) {
293
+ return rule.ruleDesc
294
+ }
277
295
  return ['WRONG_ENU_VALUE', fCfgItem.fieldUrl, rule.exprVal]
278
296
  }
279
297
  } else if (rule.checkType == 'REGEX') {
@@ -295,6 +313,9 @@ function IsIntOk(fCfgItem, paramValue) {
295
313
  }
296
314
  }
297
315
  if (!isPass) {
316
+ if (rule.ruleDesc) {
317
+ return rule.ruleDesc
318
+ }
298
319
  return ['WRONG_REGEX_VALUE', fCfgItem.fieldUrl, exprVal]
299
320
  }
300
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xzwebx-httpfilter",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "main": "HttpFilter.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"