Browse Source

hide form parsing for now

tags/v0.9.0
jimzhan 9 years ago
parent
commit
838aecf1ad
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      form/form.go
  2. +1
    -1
      form/form_test.go

+ 1
- 1
form/form.go View File



// Parse parsed the raw query from the URL and updates request.Form, // Parse parsed the raw query from the URL and updates request.Form,
// decode the from to the given struct with Validator implemented. // decode the from to the given struct with Validator implemented.
func Parse(r *http.Request, form Validator) (err error) {
func parse(r *http.Request, form Validator) (err error) {
if err = r.ParseForm(); err == nil { if err = r.ParseForm(); err == nil {
if err = schema.Decode(form, r.Form); err == nil { if err = schema.Decode(form, r.Form); err == nil {
err = form.Validate() err = form.Validate()

+ 1
- 1
form/form_test.go View File

func TestParse(t *testing.T) { func TestParse(t *testing.T) {
app := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { app := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var form user var form user
if err := Parse(r, &form); err == nil {
if err := parse(r, &form); err == nil {
w.WriteHeader(http.StatusAccepted) w.WriteHeader(http.StatusAccepted)
io.WriteString(w, "uid") io.WriteString(w, "uid")
} else { } else {

Loading…
Cancel
Save