Skip to main content

computed_policy

Function computed_policy 

Source
pub const fn computed_policy() -> &'static str
Expand description

Returns the canonical Content-Security-Policy string that the CSP plugin’s inline-extraction posture is designed to enforce.

This is the single source of truth for the CSP header value: every other emitter (deploy adapters, edge-headers postprocess plugin) reads from this function rather than recomputing or hardcoding the string, ensuring that platform-level HTTP headers and the <meta http-equiv> injection stay in lock-step.

Returns a borrowed reference to DEFAULT_CSP_POLICY today; the signature is intentionally a borrowed &'static str so callers can pass it directly into format! / write! without an extra allocation.

§Examples

use ssg::csp::computed_policy;

let policy = computed_policy();
assert!(policy.contains("default-src"));