Home / Function/ testBodyBindingUseNumber() — gin Function Reference

testBodyBindingUseNumber() — gin Function Reference

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

Function go RequestBinding FormBinding calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  c06a857d_3d52_c024_e295_9f931fdd3192["testBodyBindingUseNumber()"]
  314c6481_2bd0_e5a7_282c_94e41df6062a["binding_test.go"]
  c06a857d_3d52_c024_e295_9f931fdd3192 -->|defined in| 314c6481_2bd0_e5a7_282c_94e41df6062a
  0642fa9e_56b0_aeb5_a426_3193ffef2a86["TestBindingJSONUseNumber()"]
  0642fa9e_56b0_aeb5_a426_3193ffef2a86 -->|calls| c06a857d_3d52_c024_e295_9f931fdd3192
  aebd0564_565b_ba1b_7f92_4baaca0e7b7e["requestWithBody()"]
  c06a857d_3d52_c024_e295_9f931fdd3192 -->|calls| aebd0564_565b_ba1b_7f92_4baaca0e7b7e
  style c06a857d_3d52_c024_e295_9f931fdd3192 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 1272–1289

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

	obj := FooStructUseNumber{}
	req := requestWithBody(http.MethodPost, path, body)
	EnableDecoderUseNumber = true
	err := b.Bind(req, &obj)
	require.NoError(t, err)
	// we hope it is int64(123)
	v, e := obj.Foo.(json.Number).Int64()
	require.NoError(t, e)
	assert.Equal(t, int64(123), v)

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

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free