Home / Function/ Test_Bind_All_StructValidator() — fiber Function Reference

Test_Bind_All_StructValidator() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

bind_test.go lines 2340–2359

func Test_Bind_All_StructValidator(t *testing.T) {
	t.Parallel()
	app := New(Config{StructValidator: &structValidator{}})

	// Success case: name comes from body only
	ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
	ctx.Request().Header.SetContentType(MIMEApplicationJSON)
	ctx.Request().SetBody([]byte(`{"name":"john"}`))
	sq := new(simpleQuery)
	require.NoError(t, (&Bind{ctx: ctx}).All(sq))
	require.Equal(t, "john", sq.Name)

	// Failure: missing name everywhere
	ctxFail := app.AcquireCtx(&fasthttp.RequestCtx{})
	ctxFail.Request().Header.SetContentType(MIMEApplicationJSON)
	ctxFail.Request().SetBody([]byte(`{}`))
	sqFail := new(simpleQuery)
	err := (&Bind{ctx: ctxFail}).WithoutAutoHandling().All(sqFail)
	require.EqualError(t, err, "you should have entered right name")
}

Domain

Subdomains

Defined In

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free