Home / Function/ testBodyBinding() — gin Function Reference

testBodyBinding() — gin Function Reference

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

Function go RequestBinding FormBinding calls 1 called by 5

Entity Profile

Dependency Diagram

graph TD
  2726b89c_90f4_05b5_9dc0_ce5de910b509["testBodyBinding()"]
  314c6481_2bd0_e5a7_282c_94e41df6062a["binding_test.go"]
  2726b89c_90f4_05b5_9dc0_ce5de910b509 -->|defined in| 314c6481_2bd0_e5a7_282c_94e41df6062a
  20fc2b8c_7597_7e17_fabc_7f1b8d53bf56["TestBindingJSON()"]
  20fc2b8c_7597_7e17_fabc_7f1b8d53bf56 -->|calls| 2726b89c_90f4_05b5_9dc0_ce5de910b509
  967c2123_e48d_33d7_6e2a_19f8b42f7262["TestBindingXML()"]
  967c2123_e48d_33d7_6e2a_19f8b42f7262 -->|calls| 2726b89c_90f4_05b5_9dc0_ce5de910b509
  34a23cad_0200_4f2b_4090_007562eacea2["TestBindingTOML()"]
  34a23cad_0200_4f2b_4090_007562eacea2 -->|calls| 2726b89c_90f4_05b5_9dc0_ce5de910b509
  4d1c877d_16f3_1659_7beb_dfcf191d95ab["TestBindingYAML()"]
  4d1c877d_16f3_1659_7beb_dfcf191d95ab -->|calls| 2726b89c_90f4_05b5_9dc0_ce5de910b509
  03acf29c_fc8e_9fdf_bb65_8f3081cb59c7["TestBindingBSON()"]
  03acf29c_fc8e_9fdf_bb65_8f3081cb59c7 -->|calls| 2726b89c_90f4_05b5_9dc0_ce5de910b509
  aebd0564_565b_ba1b_7f92_4baaca0e7b7e["requestWithBody()"]
  2726b89c_90f4_05b5_9dc0_ce5de910b509 -->|calls| aebd0564_565b_ba1b_7f92_4baaca0e7b7e
  style 2726b89c_90f4_05b5_9dc0_ce5de910b509 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 1217–1230

func testBodyBinding(t *testing.T, b Binding, name, path, badPath, body, badBody string) {
	assert.Equal(t, name, b.Name())

	obj := FooStruct{}
	req := requestWithBody(http.MethodPost, path, body)
	err := b.Bind(req, &obj)
	require.NoError(t, err)
	assert.Equal(t, "bar", obj.Foo)

	obj = FooStruct{}
	req = requestWithBody(http.MethodPost, badPath, badBody)
	err = JSON.Bind(req, &obj)
	require.Error(t, err)
}

Subdomains

Frequently Asked Questions

What does testBodyBinding() do?
testBodyBinding() is a function in the gin codebase, defined in binding/binding_test.go.
Where is testBodyBinding() defined?
testBodyBinding() is defined in binding/binding_test.go at line 1217.
What does testBodyBinding() call?
testBodyBinding() calls 1 function(s): requestWithBody.
What calls testBodyBinding()?
testBodyBinding() is called by 5 function(s): TestBindingBSON, TestBindingJSON, TestBindingTOML, TestBindingXML, TestBindingYAML.

Analyze Your Own Codebase

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

Try Supermodel Free