Home / Function/ testFormBindingDefaultValue() — gin Function Reference

testFormBindingDefaultValue() — gin Function Reference

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

Function go RequestBinding FormBinding calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  a9c09ee1_af69_2d7b_b601_feede46c0038["testFormBindingDefaultValue()"]
  314c6481_2bd0_e5a7_282c_94e41df6062a["binding_test.go"]
  a9c09ee1_af69_2d7b_b601_feede46c0038 -->|defined in| 314c6481_2bd0_e5a7_282c_94e41df6062a
  af8d65b6_9929_1059_b50e_173173e451b1["TestBindingFormDefaultValue()"]
  af8d65b6_9929_1059_b50e_173173e451b1 -->|calls| a9c09ee1_af69_2d7b_b601_feede46c0038
  8d17ff78_65b9_a072_edf8_b3f566abed01["TestBindingFormDefaultValue2()"]
  8d17ff78_65b9_a072_edf8_b3f566abed01 -->|calls| a9c09ee1_af69_2d7b_b601_feede46c0038
  aebd0564_565b_ba1b_7f92_4baaca0e7b7e["requestWithBody()"]
  a9c09ee1_af69_2d7b_b601_feede46c0038 -->|calls| aebd0564_565b_ba1b_7f92_4baaca0e7b7e
  style a9c09ee1_af69_2d7b_b601_feede46c0038 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 894–912

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

	obj := FooDefaultBarStruct{}
	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, "hello", obj.Bar)

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

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free