Home / Function/ Test_HSTSExcludeSubdomainsAndPreload() — fiber Function Reference

Test_HSTSExcludeSubdomainsAndPreload() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

middleware/helmet/helmet_test.go lines 237–261

func Test_HSTSExcludeSubdomainsAndPreload(t *testing.T) {
	hstsAge := 31536000
	app := fiber.New()

	app.Use(New(Config{
		HSTSMaxAge:            hstsAge,
		HSTSExcludeSubdomains: true,
		HSTSPreloadEnabled:    true,
	}))

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

	handler := app.Handler()
	ctx := &fasthttp.RequestCtx{}

	ctx.Request.SetRequestURI("/")
	ctx.Request.Header.SetMethod(fiber.MethodGet)
	ctx.Request.Header.SetProtocol("https")

	handler(ctx)

	require.Equal(t, "max-age=31536000; preload", string(ctx.Response.Header.Peek(fiber.HeaderStrictTransportSecurity)))
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free