Tuấn Hiệp
Tuấn Hiệp

Reputation: 11

Validation Rules for Non-Empty Strings with express-validator Not Working as Expected

ValidationChain Express-validator not working when use obj config

Anyone can help me for this problem. I have two this property. "Status" not working when my req.body.status="", but type still work truthly. [enter image description here]. Here is config of two this (https://i.sstatic.net/1KYwNpv3.png). I use "express-validator" module npm nodejs


I tried add NotEmpty

But still not working Server response Server still return empty Status and not check another validate Here is my routes

Upvotes: 0

Views: 32

Answers (1)

Melvin Kosisochukwu
Melvin Kosisochukwu

Reputation: 392

You need to add the notEmpty method to the schema definition to disallow empty strings

Upvotes: 0

Related Questions