mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-23 18:22:23 +08:00
add test case
This commit is contained in:
parent
f9b4e94277
commit
1c933e01b2
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user