diff --git a/binding/binding_test.go b/binding/binding_test.go index e2e92c5e..8279dc8c 100644 --- a/binding/binding_test.go +++ b/binding/binding_test.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "mime/multipart" "net/http" + "strings" "testing" "time" @@ -578,6 +579,20 @@ func testFormBinding(t *testing.T, method, path, badPath, body, badBody string) assert.Error(t, err) } +func TestFormBindingFail(t *testing.T) { + b := Form + assert.Equal(t, b.Name(), "form") + + obj := FooBarStruct{} + req := &http.Request{ + Method: "POST", + Header: http.Header(map[string][]string{}), + Body: ioutil.NopCloser(strings.NewReader("body")), + } + err := b.Bind(req, &obj) + assert.Error(t, err) +} + func testFormBindingForTime(t *testing.T, method, path, badPath, body, badBody string) { b := Form assert.Equal(t, b.Name(), "form")