瀏覽代碼

hide form parsing for now

tags/v0.9.0
jimzhan 9 年之前
父節點
當前提交
838aecf1ad
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. +1
    -1
      form/form.go
  2. +1
    -1
      form/form_test.go

+ 1
- 1
form/form.go 查看文件

@@ -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 查看文件

@@ -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 {

Loading…
取消
儲存