Home / Function/ Test_ContentSecurityPolicyReportOnly() — fiber Function Reference

Test_ContentSecurityPolicyReportOnly() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

middleware/helmet/helmet_test.go lines 171–187

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

	app.Use(New(Config{
		ContentSecurityPolicy: "default-src 'none'",
		CSPReportOnly:         true,
	}))

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

	resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody))
	require.NoError(t, err)
	require.Equal(t, "default-src 'none'", resp.Header.Get(fiber.HeaderContentSecurityPolicyReportOnly))
	require.Empty(t, resp.Header.Get(fiber.HeaderContentSecurityPolicy))
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free