Bläddra i källkod

hide form parsing for now

tags/v0.9.0
jimzhan 9 år sedan
förälder
incheckning
838aecf1ad
2 ändrade filer med 2 tillägg och 2 borttagningar
  1. +1
    -1
      form/form.go
  2. +1
    -1
      form/form_test.go

+ 1
- 1
form/form.go Visa fil

@@ -14,7 +14,7 @@ type Validator interface {

// Parse parsed the raw query from the URL and updates request.Form,
// 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 = schema.Decode(form, r.Form); err == nil {
err = form.Validate()

+ 1
- 1
form/form_test.go Visa fil

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

Laddar…
Avbryt
Spara