MCPcopy
hub / github.com/gin-gonic/gin / testFormBindingForTimeNotFormat

Function testFormBindingForTimeNotFormat

binding/binding_test.go:1000–1016  ·  view source on GitHub ↗
(t *testing.T, method, path, badPath, body, badBody string)

Source from the content-addressed store, hash-verified

998}
999
1000func testFormBindingForTimeNotFormat(t *testing.T, method, path, badPath, body, badBody string) {
1001 b := Form
1002 assert.Equal(t, "form", b.Name())
1003
1004 obj := FooStructForTimeTypeNotFormat{}
1005 req := requestWithBody(method, path, body)
1006 if method == http.MethodPost {
1007 req.Header.Add("Content-Type", MIMEPOSTForm)
1008 }
1009 err := b.Bind(req, &obj)
1010 require.Error(t, err)
1011
1012 obj = FooStructForTimeTypeNotFormat{}
1013 req = requestWithBody(method, badPath, badBody)
1014 err = JSON.Bind(req, &obj)
1015 require.Error(t, err)
1016}
1017
1018func testFormBindingForTimeFailFormat(t *testing.T, method, path, badPath, body, badBody string) {
1019 b := Form

Callers 2

TestBindingFormForTimeFunction · 0.85
TestBindingFormForTime2Function · 0.85

Calls 4

requestWithBodyFunction · 0.85
NameMethod · 0.65
BindMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected