forms provides a way to parse http Request forms using a schema
The forms package can be added to a project by running:
go get cattlecloud.net/go/forms@latestimport "cattlecloud.net/go/forms"var (
name string
age int
)
err := forms.Parse(request, forms.Schema{
"NAME": forms.String(&name),
"AGE": forms.Int(&age),
})Typically the HTTP request will be given to you in the form of an http handler, e.g.
func(w http.ResponseWriter, r *http.Request) {
_ = r.ParseForm()
// now r form data is available to parse
}The cattlecloud.net/go/forms module is open source under the BSD license.