1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-13 14:11:02 +00:00

Merge pull request #2365 from chesedo/RequiredValidationCatchSpaces

[WIP]Have Required validator trim strings to fix #2361
This commit is contained in:
astaxie
2017-05-18 22:44:15 +08:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,12 @@ func TestRequired(t *testing.T) {
if valid.Required("", "string").Ok {
t.Error("\"'\" string should be false")
}
if valid.Required(" ", "string").Ok {
t.Error("\" \" string should be false") // For #2361
}
if valid.Required("\n", "string").Ok {
t.Error("new line string should be false") // For #2361
}
if !valid.Required("astaxie", "string").Ok {
t.Error("string should be true")
}