Test_FormBinder_Bind() — fiber Function Reference
Architecture documentation for the Test_FormBinder_Bind() function in form_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD dbea925f_b94a_a100_b942_603c4fc932ef["Test_FormBinder_Bind()"] 9e2874af_daa9_2d85_5c35_752d6b7678f6["form_test.go"] dbea925f_b94a_a100_b942_603c4fc932ef -->|defined in| 9e2874af_daa9_2d85_5c35_752d6b7678f6 style dbea925f_b94a_a100_b942_603c4fc932ef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
binder/form_test.go lines 13–55
func Test_FormBinder_Bind(t *testing.T) {
t.Parallel()
b := &FormBinding{
EnableSplitting: true,
}
require.Equal(t, "form", b.Name())
type Post struct {
Title string `form:"title"`
}
type User struct {
Name string `form:"name"`
Names []string `form:"names"`
Posts []Post `form:"posts"`
Age int `form:"age"`
}
var user User
req := fasthttp.AcquireRequest()
req.SetBodyString("name=john&names=john,doe&age=42&posts[0][title]=post1&posts[1][title]=post2&posts[2][title]=post3")
req.Header.SetContentType("application/x-www-form-urlencoded")
t.Cleanup(func() {
fasthttp.ReleaseRequest(req)
})
err := b.Bind(req, &user)
require.NoError(t, err)
require.Equal(t, "john", user.Name)
require.Equal(t, 42, user.Age)
require.Len(t, user.Posts, 3)
require.Equal(t, "post1", user.Posts[0].Title)
require.Equal(t, "post2", user.Posts[1].Title)
require.Equal(t, "post3", user.Posts[2].Title)
require.Contains(t, user.Names, "john")
require.Contains(t, user.Names, "doe")
b.Reset()
require.False(t, b.EnableSplitting)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_FormBinder_Bind() do?
Test_FormBinder_Bind() is a function in the fiber codebase, defined in binder/form_test.go.
Where is Test_FormBinder_Bind() defined?
Test_FormBinder_Bind() is defined in binder/form_test.go at line 13.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free