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

Function testFormBindingForTimeFailLocation

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

Source from the content-addressed store, hash-verified

1034}
1035
1036func testFormBindingForTimeFailLocation(t *testing.T, method, path, badPath, body, badBody string) {
1037 b := Form
1038 assert.Equal(t, "form", b.Name())
1039
1040 obj := FooStructForTimeTypeFailLocation{}
1041 req := requestWithBody(method, path, body)
1042 if method == http.MethodPost {
1043 req.Header.Add("Content-Type", MIMEPOSTForm)
1044 }
1045 err := b.Bind(req, &obj)
1046 require.Error(t, err)
1047
1048 obj = FooStructForTimeTypeFailLocation{}
1049 req = requestWithBody(method, badPath, badBody)
1050 err = JSON.Bind(req, &obj)
1051 require.Error(t, err)
1052}
1053
1054func testFormBindingIgnoreField(t *testing.T, method, path, badPath, body, badBody string) {
1055 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