Home / Function/ Test_Next() — fiber Function Reference

Test_Next() — fiber Function Reference

Architecture documentation for the Test_Next() function in helmet_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  c7386c3f_4287_5b68_d3c4_3cfbaace9d78["Test_Next()"]
  dc893b58_cc7a_94e6_441a_587c6543a0cd["helmet_test.go"]
  c7386c3f_4287_5b68_d3c4_3cfbaace9d78 -->|defined in| dc893b58_cc7a_94e6_441a_587c6543a0cd
  style c7386c3f_4287_5b68_d3c4_3cfbaace9d78 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/helmet/helmet_test.go lines 129–153

func Test_Next(t *testing.T) {
	app := fiber.New()

	app.Use(New(Config{
		Next: func(ctx fiber.Ctx) bool {
			return ctx.Path() == "/next"
		},
		ReferrerPolicy: "no-referrer",
	}))

	app.Get("/", func(c fiber.Ctx) error {
		return c.SendString("Hello, World!")
	})
	app.Get("/next", func(c fiber.Ctx) error {
		return c.SendString("Skipped!")
	})

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
	require.NoError(t, err)
	require.Equal(t, "no-referrer", resp.Header.Get(fiber.HeaderReferrerPolicy))

	resp, err = app.Test(httptest.NewRequest(fiber.MethodGet, "/next", http.NoBody))
	require.NoError(t, err)
	require.Empty(t, resp.Header.Get(fiber.HeaderReferrerPolicy))
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Next() do?
Test_Next() is a function in the fiber codebase, defined in middleware/helmet/helmet_test.go.
Where is Test_Next() defined?
Test_Next() is defined in middleware/helmet/helmet_test.go at line 129.

Analyze Your Own Codebase

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

Try Supermodel Free