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

Function testFormBindingEmbeddedStruct

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

Source from the content-addressed store, hash-verified

856}
857
858func testFormBindingEmbeddedStruct(t *testing.T, method, path, badPath, body, badBody string) {
859 b := Form
860 assert.Equal(t, "form", b.Name())
861
862 obj := QueryTest{}
863 req := requestWithBody(method, path, body)
864 if method == http.MethodPost {
865 req.Header.Add("Content-Type", MIMEPOSTForm)
866 }
867 err := b.Bind(req, &obj)
868 require.NoError(t, err)
869 assert.Equal(t, 1, obj.Page)
870 assert.Equal(t, 2, obj.Size)
871 assert.Equal(t, "test-appkey", obj.Appkey)
872}
873
874func testFormBinding(t *testing.T, method, path, badPath, body, badBody string) {
875 b := Form

Callers 2

Calls 3

requestWithBodyFunction · 0.85
NameMethod · 0.65
BindMethod · 0.65

Tested by

no test coverage detected