Home / Function/ testFormBinding() — gin Function Reference

testFormBinding() — gin Function Reference

Architecture documentation for the testFormBinding() function in binding_test.go from the gin codebase.

Function go RequestBinding FormBinding calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  c77c188c_036f_71e7_ba7b_68e02072468c["testFormBinding()"]
  314c6481_2bd0_e5a7_282c_94e41df6062a["binding_test.go"]
  c77c188c_036f_71e7_ba7b_68e02072468c -->|defined in| 314c6481_2bd0_e5a7_282c_94e41df6062a
  30fa3a28_55a7_4a05_ab2e_a3d9e30ae6a8["TestBindingForm()"]
  30fa3a28_55a7_4a05_ab2e_a3d9e30ae6a8 -->|calls| c77c188c_036f_71e7_ba7b_68e02072468c
  fa6ccd4f_6cb1_15fb_1f75_50491a752611["TestBindingForm2()"]
  fa6ccd4f_6cb1_15fb_1f75_50491a752611 -->|calls| c77c188c_036f_71e7_ba7b_68e02072468c
  aebd0564_565b_ba1b_7f92_4baaca0e7b7e["requestWithBody()"]
  c77c188c_036f_71e7_ba7b_68e02072468c -->|calls| aebd0564_565b_ba1b_7f92_4baaca0e7b7e
  style c77c188c_036f_71e7_ba7b_68e02072468c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 874–892

func testFormBinding(t *testing.T, method, path, badPath, body, badBody string) {
	b := Form
	assert.Equal(t, "form", b.Name())

	obj := FooBarStruct{}
	req := requestWithBody(method, path, body)
	if method == http.MethodPost {
		req.Header.Add("Content-Type", MIMEPOSTForm)
	}
	err := b.Bind(req, &obj)
	require.NoError(t, err)
	assert.Equal(t, "bar", obj.Foo)
	assert.Equal(t, "foo", obj.Bar)

	obj = FooBarStruct{}
	req = requestWithBody(method, badPath, badBody)
	err = JSON.Bind(req, &obj)
	require.Error(t, err)
}

Subdomains

Frequently Asked Questions

What does testFormBinding() do?
testFormBinding() is a function in the gin codebase, defined in binding/binding_test.go.
Where is testFormBinding() defined?
testFormBinding() is defined in binding/binding_test.go at line 874.
What does testFormBinding() call?
testFormBinding() calls 1 function(s): requestWithBody.
What calls testFormBinding()?
testFormBinding() is called by 2 function(s): TestBindingForm, TestBindingForm2.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free