Home / Function/ Test_Bind_CustomBinder() — fiber Function Reference

Test_Bind_CustomBinder() — fiber Function Reference

Architecture documentation for the Test_Bind_CustomBinder() function in bind_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  da2f15db_7b87_03d9_274f_99ee50a8469c["Test_Bind_CustomBinder()"]
  55065b01_f5dc_4e53_5a74_5ecc7aca8f52["bind_test.go"]
  da2f15db_7b87_03d9_274f_99ee50a8469c -->|defined in| 55065b01_f5dc_4e53_5a74_5ecc7aca8f52
  style da2f15db_7b87_03d9_274f_99ee50a8469c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

bind_test.go lines 1817–1838

func Test_Bind_CustomBinder(t *testing.T) {
	app := New()
	c := app.AcquireCtx(&fasthttp.RequestCtx{})

	// Register binder
	customBinder := &customBinder{}
	app.RegisterCustomBinder(customBinder)

	type Demo struct {
		Name string `json:"name"`
	}
	body := []byte(`{"name":"john"}`)
	c.Request().SetBody(body)
	c.Request().Header.SetContentType("test")
	c.Request().Header.SetContentLength(len(body))
	d := new(Demo)

	require.NoError(t, c.Bind().Body(d))
	require.NoError(t, c.Bind().Custom("custom", d))
	require.Equal(t, ErrCustomBinderNotFound, c.Bind().Custom("not_custom", d))
	require.Equal(t, "john", d.Name)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_Bind_CustomBinder() do?
Test_Bind_CustomBinder() is a function in the fiber codebase, defined in bind_test.go.
Where is Test_Bind_CustomBinder() defined?
Test_Bind_CustomBinder() is defined in bind_test.go at line 1817.

Analyze Your Own Codebase

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

Try Supermodel Free