Writing tests for the Forms package

This commit is contained in:
Muyao CHEN
2024-07-02 21:48:00 +02:00
parent 875be55076
commit d87d8ed594
4 changed files with 156 additions and 24 deletions

View File

@ -100,8 +100,8 @@ func (m *Repository) PostMakeReservation(w http.ResponseWriter, r *http.Request)
form := forms.New(r.PostForm)
form.Required("first_name", "last_name", "email")
form.MinLength("first_name", 2, r)
form.IsEmail("email", r)
form.MinLength("first_name", 2)
form.IsEmail("email")
if !form.Valid() {
data := make(map[string]interface{})