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 DataBinding Mappers calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  2b2fc7b8_c794_4161_5e19_36f6c5cddb09["testFormBinding()"]
  6a68be66_aeca_48fa_6fd9_6f3d54c99a18["TestBindingForm()"]
  6a68be66_aeca_48fa_6fd9_6f3d54c99a18 -->|calls| 2b2fc7b8_c794_4161_5e19_36f6c5cddb09
  41ba1d38_6da9_90ca_fcd7_09fcc8a58d77["TestBindingForm2()"]
  41ba1d38_6da9_90ca_fcd7_09fcc8a58d77 -->|calls| 2b2fc7b8_c794_4161_5e19_36f6c5cddb09
  2899e942_a23d_574e_8d47_d28e895c2604["requestWithBody()"]
  2b2fc7b8_c794_4161_5e19_36f6c5cddb09 -->|calls| 2899e942_a23d_574e_8d47_d28e895c2604
  style 2b2fc7b8_c794_4161_5e19_36f6c5cddb09 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)
}

Domain

Subdomains

Frequently Asked Questions

What does testFormBinding() do?
testFormBinding() is a function in the gin codebase.
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