Home / Function/ TestBindingQueryStringMap() — gin Function Reference

TestBindingQueryStringMap() — gin Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e5a9493a_d3e9_b9b7_0c81_08065bcb2643["TestBindingQueryStringMap()"]
  2899e942_a23d_574e_8d47_d28e895c2604["requestWithBody()"]
  e5a9493a_d3e9_b9b7_0c81_08065bcb2643 -->|calls| 2899e942_a23d_574e_8d47_d28e895c2604
  style e5a9493a_d3e9_b9b7_0c81_08065bcb2643 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/binding_test.go lines 432–452

func TestBindingQueryStringMap(t *testing.T) {
	b := Query

	obj := make(map[string]string)
	req := requestWithBody(http.MethodGet, "/?foo=bar&hello=world", "")
	err := b.Bind(req, &obj)
	require.NoError(t, err)
	assert.NotNil(t, obj)
	assert.Len(t, obj, 2)
	assert.Equal(t, "bar", obj["foo"])
	assert.Equal(t, "world", obj["hello"])

	obj = make(map[string]string)
	req = requestWithBody(http.MethodGet, "/?foo=bar&foo=2&hello=world", "") // should pick last
	err = b.Bind(req, &obj)
	require.NoError(t, err)
	assert.NotNil(t, obj)
	assert.Len(t, obj, 2)
	assert.Equal(t, "2", obj["foo"])
	assert.Equal(t, "world", obj["hello"])
}

Domain

Subdomains

Frequently Asked Questions

What does TestBindingQueryStringMap() do?
TestBindingQueryStringMap() is a function in the gin codebase.
What does TestBindingQueryStringMap() call?
TestBindingQueryStringMap() calls 1 function(s): requestWithBody.

Analyze Your Own Codebase

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

Try Supermodel Free