Home / Function/ Benchmark_CookieBinder_Bind() — fiber Function Reference

Benchmark_CookieBinder_Bind() — fiber Function Reference

Architecture documentation for the Benchmark_CookieBinder_Bind() function in cookie_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  8d4b6bad_a748_5e31_56dd_c1030af3e5c9["Benchmark_CookieBinder_Bind()"]
  738bd173_a1e5_8674_8a50_d2c19621cb9a["cookie_test.go"]
  8d4b6bad_a748_5e31_56dd_c1030af3e5c9 -->|defined in| 738bd173_a1e5_8674_8a50_d2c19621cb9a
  style 8d4b6bad_a748_5e31_56dd_c1030af3e5c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/cookie_test.go lines 52–87

func Benchmark_CookieBinder_Bind(b *testing.B) {
	b.ReportAllocs()

	binder := &CookieBinding{
		EnableSplitting: true,
	}

	type User struct {
		Name  string   `query:"name"`
		Posts []string `query:"posts"`
		Age   int      `query:"age"`
	}
	var user User

	req := fasthttp.AcquireRequest()
	b.Cleanup(func() {
		fasthttp.ReleaseRequest(req)
	})

	req.Header.SetCookie("name", "john")
	req.Header.SetCookie("age", "42")
	req.Header.SetCookie("posts", "post1,post2,post3")

	var err error
	for b.Loop() {
		err = binder.Bind(req, &user)
	}

	require.NoError(b, err)
	require.Equal(b, "john", user.Name)
	require.Equal(b, 42, user.Age)
	require.Len(b, user.Posts, 3)
	require.Contains(b, user.Posts, "post1")
	require.Contains(b, user.Posts, "post2")
	require.Contains(b, user.Posts, "post3")
}

Domain

Subdomains

Frequently Asked Questions

What does Benchmark_CookieBinder_Bind() do?
Benchmark_CookieBinder_Bind() is a function in the fiber codebase, defined in binder/cookie_test.go.
Where is Benchmark_CookieBinder_Bind() defined?
Benchmark_CookieBinder_Bind() is defined in binder/cookie_test.go at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free