Skip to content

Commit

Permalink
add bare methods to form
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescun committed Jul 22, 2016
1 parent fce984a commit 01cb74e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions form.go
Expand Up @@ -30,6 +30,12 @@ func NewForm() Form {
}
}

// ParseAndValidate first decodes a reader using the first decoder matching the
// given mime type, then applies validation to the collected input
func ParseAndValidate(r io.Reader, mime string, dst interface{}) error {
return form.ParseAndValidate(r, mime, dst)
}

// ParseAndValidate first decodes a reader using the first decoder matching the
// given mime type, then applies validation to the collected input
func (f Form) ParseAndValidate(r io.Reader, mime string, dst interface{}) error {
Expand All @@ -51,6 +57,12 @@ func (f Form) ParseAndValidate(r io.Reader, mime string, dst interface{}) error
return nil
}

// ParseRequestAndValidate is the same as ParseAndValidate accepting a HTTP
// request for the reader and using the "Content-Type" header for the MIME type
func ParseRequestAndValidate(r *http.Request, dst interface{}) error {
return form.ParseRequestAndValidate(r, dst)
}

// ParseRequestAndValidate is the same as ParseAndValidate accepting a HTTP
// request for the reader and using the "Content-Type" header for the MIME type
func (f Form) ParseRequestAndValidate(r *http.Request, dst interface{}) error {
Expand Down

0 comments on commit 01cb74e

Please sign in to comment.