absoludity/goforms — pull request #5 by Omie (2014-12-07 19:46:05+00:00)
Title: Empty value validation fix

Fixed the way empty values were handled.

Even if there is an empty value, it would return values with length 1, reason for this behavior lies in the [url.ParseQuery()](https://golang.org/src/pkg/net/url/url.go?s=13525:13576#L511) implementation.

The tests were passing because a handcrafted structure of type url.Values was being used. In real scenarios that is not the case. The form data that we use, request.Form is a result of ParseQuery()

I have fixed the tests to mimic this behavior. If you cherrypick to this commit and run the tests, you'd see the difference.

Fix is easy enough. Simply check for empty values again in case 1: and set exists=false if that be true.

Tested with 1.3.1 linux/amd64

Thanks for writing this. I have quite strong django background and wanted to have something similar for validation.