Home / Function/ Benchmark_RespHeaderBinder_Bind() — fiber Function Reference

Benchmark_RespHeaderBinder_Bind() — fiber Function Reference

Architecture documentation for the Benchmark_RespHeaderBinder_Bind() function in resp_header_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  da234448_2d17_4aaf_32f6_ad41d7585ea5["Benchmark_RespHeaderBinder_Bind()"]
  ffaa6d07_2478_6275_a2d8_10230f0ee2db["resp_header_test.go"]
  da234448_2d17_4aaf_32f6_ad41d7585ea5 -->|defined in| ffaa6d07_2478_6275_a2d8_10230f0ee2db
  style da234448_2d17_4aaf_32f6_ad41d7585ea5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/resp_header_test.go lines 45–77

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

	binder := &RespHeaderBinding{
		EnableSplitting: true,
	}

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

	resp := fasthttp.AcquireResponse()
	resp.Header.Set("name", "john")
	resp.Header.Set("age", "42")
	resp.Header.Set("posts", "post1,post2,post3")

	b.Cleanup(func() {
		fasthttp.ReleaseResponse(resp)
	})

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

	require.NoError(b, err)
	require.Equal(b, "john", user.Name)
	require.Equal(b, 42, user.Age)
	require.Equal(b, []string{"post1", "post2", "post3"}, user.Posts)
}

Domain

Subdomains

Frequently Asked Questions

What does Benchmark_RespHeaderBinder_Bind() do?
Benchmark_RespHeaderBinder_Bind() is a function in the fiber codebase, defined in binder/resp_header_test.go.
Where is Benchmark_RespHeaderBinder_Bind() defined?
Benchmark_RespHeaderBinder_Bind() is defined in binder/resp_header_test.go at line 45.

Analyze Your Own Codebase

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

Try Supermodel Free