Home / Function/ testProtoBodyBinding() — gin Function Reference

testProtoBodyBinding() — gin Function Reference

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

Function go RequestBinding FormBinding calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  ff93e522_884a_58c9_c57a_148633b37c6b["testProtoBodyBinding()"]
  314c6481_2bd0_e5a7_282c_94e41df6062a["binding_test.go"]
  ff93e522_884a_58c9_c57a_148633b37c6b -->|defined in| 314c6481_2bd0_e5a7_282c_94e41df6062a
  b5c03f7e_df77_daca_348c_d7f0d9afa40e["TestBindingProtoBuf()"]
  b5c03f7e_df77_daca_348c_d7f0d9afa40e -->|calls| ff93e522_884a_58c9_c57a_148633b37c6b
  aebd0564_565b_ba1b_7f92_4baaca0e7b7e["requestWithBody()"]
  ff93e522_884a_58c9_c57a_148633b37c6b -->|calls| aebd0564_565b_ba1b_7f92_4baaca0e7b7e
  style ff93e522_884a_58c9_c57a_148633b37c6b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 1343–1358

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

	obj := protoexample.Test{}
	req := requestWithBody(http.MethodPost, path, body)
	req.Header.Add("Content-Type", MIMEPROTOBUF)
	err := b.Bind(req, &obj)
	require.NoError(t, err)
	assert.Equal(t, "yes", *obj.Label)

	obj = protoexample.Test{}
	req = requestWithBody(http.MethodPost, badPath, badBody)
	req.Header.Add("Content-Type", MIMEPROTOBUF)
	err = ProtoBuf.Bind(req, &obj)
	require.Error(t, err)
}

Subdomains

Frequently Asked Questions

What does testProtoBodyBinding() do?
testProtoBodyBinding() is a function in the gin codebase, defined in binding/binding_test.go.
Where is testProtoBodyBinding() defined?
testProtoBodyBinding() is defined in binding/binding_test.go at line 1343.
What does testProtoBodyBinding() call?
testProtoBodyBinding() calls 1 function(s): requestWithBody.
What calls testProtoBodyBinding()?
testProtoBodyBinding() is called by 1 function(s): TestBindingProtoBuf.

Analyze Your Own Codebase

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

Try Supermodel Free