testBodyBindingDisallowUnknownFields() — gin Function Reference
Architecture documentation for the testBodyBindingDisallowUnknownFields() function in binding_test.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 53962b1b_2d32_74a0_d317_f76dd1e264ee["testBodyBindingDisallowUnknownFields()"] a2f57fc4_87c9_bc86_f01e_0ed8dc59328d["TestBindingJSONDisallowUnknownFields()"] a2f57fc4_87c9_bc86_f01e_0ed8dc59328d -->|calls| 53962b1b_2d32_74a0_d317_f76dd1e264ee 2899e942_a23d_574e_8d47_d28e895c2604["requestWithBody()"] 53962b1b_2d32_74a0_d317_f76dd1e264ee -->|calls| 2899e942_a23d_574e_8d47_d28e895c2604 style 53962b1b_2d32_74a0_d317_f76dd1e264ee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binding/binding_test.go lines 1309–1326
func testBodyBindingDisallowUnknownFields(t *testing.T, b Binding, path, badPath, body, badBody string) {
EnableDecoderDisallowUnknownFields = true
defer func() {
EnableDecoderDisallowUnknownFields = false
}()
obj := FooStructDisallowUnknownFields{}
req := requestWithBody(http.MethodPost, path, body)
err := b.Bind(req, &obj)
require.NoError(t, err)
assert.Equal(t, "bar", obj.Foo)
obj = FooStructDisallowUnknownFields{}
req = requestWithBody(http.MethodPost, badPath, badBody)
err = JSON.Bind(req, &obj)
require.Error(t, err)
assert.Contains(t, err.Error(), "what")
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does testBodyBindingDisallowUnknownFields() do?
testBodyBindingDisallowUnknownFields() is a function in the gin codebase.
What does testBodyBindingDisallowUnknownFields() call?
testBodyBindingDisallowUnknownFields() calls 1 function(s): requestWithBody.
What calls testBodyBindingDisallowUnknownFields()?
testBodyBindingDisallowUnknownFields() is called by 1 function(s): TestBindingJSONDisallowUnknownFields.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free