diff --git a/src/content/docs/en/reference/api-reference.mdx b/src/content/docs/en/reference/api-reference.mdx index 6b4b20de997d1..1f00246f1e2d3 100644 --- a/src/content/docs/en/reference/api-reference.mdx +++ b/src/content/docs/en/reference/api-reference.mdx @@ -1054,7 +1054,7 @@ Loads a session by ID. In normal use, a session is loaded automatically from the

-**Type**: `AstroSharedContextCsp` +**Type**: `object | undefined`

@@ -1077,8 +1077,8 @@ Adds a single directive to the current page. You can call this method multiple t ```astro title="src/pages/index.astro" --- -Astro.csp.insertDirective("default-src 'self'"); -Astro.csp.insertDirective("img-src 'self' https://images.cdn.example.com"); +Astro.csp?.insertDirective("default-src 'self'"); +Astro.csp?.insertDirective("img-src 'self' https://images.cdn.example.com"); --- ``` @@ -1108,7 +1108,7 @@ Inserts a new resource to be used for the `style-src` directive. ```astro title="src/pages/index.astro" --- -Astro.csp.insertStyleResource("https://styles.cdn.example.com"); +Astro.csp?.insertStyleResource("https://styles.cdn.example.com"); --- ``` @@ -1136,7 +1136,7 @@ Adds a new hash to the `style-src` directive. ```astro title="src/pages/index.astro" --- -Astro.csp.insertStyleHash("sha512-styleHash"); +Astro.csp?.insertStyleHash("sha512-styleHash"); --- ``` @@ -1164,7 +1164,7 @@ Inserts a new valid source to be used for the `script-src` directive. ```astro title="src/pages/index.astro" --- -Astro.csp.insertScriptResource("https://scripts.cdn.example.com"); +Astro.csp?.insertScriptResource("https://scripts.cdn.example.com"); --- ``` @@ -1192,7 +1192,7 @@ Adds a new hash to the `script-src` directive. ```astro title="src/pages/index.astro" --- -Astro.csp.insertScriptHash("sha512-scriptHash"); +Astro.csp?.insertScriptHash("sha512-scriptHash"); --- ```