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

Function testFormBindingForTimeFailFormat

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

Source from the content-addressed store, hash-verified

1016}
1017
1018func testFormBindingForTimeFailFormat(t *testing.T, method, path, badPath, body, badBody string) {
1019 b := Form
1020 assert.Equal(t, "form", b.Name())
1021
1022 obj := FooStructForTimeTypeFailFormat{}
1023 req := requestWithBody(method, path, body)
1024 if method == http.MethodPost {
1025 req.Header.Add("Content-Type", MIMEPOSTForm)
1026 }
1027 err := b.Bind(req, &obj)
1028 require.Error(t, err)
1029
1030 obj = FooStructForTimeTypeFailFormat{}
1031 req = requestWithBody(method, badPath, badBody)
1032 err = JSON.Bind(req, &obj)
1033 require.Error(t, err)
1034}
1035
1036func testFormBindingForTimeFailLocation(t *testing.T, method, path, badPath, body, badBody string) {
1037 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