Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/content/docs/en/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ Loads a session by ID. In normal use, a session is loaded automatically from the

<p>

**Type**: `AstroSharedContextCsp`
**Type**: `object | undefined`
Comment thread
florian-lefebvre marked this conversation as resolved.
<Since v="6.0.0" />
</p>

Expand All @@ -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");
---
```

Expand Down Expand Up @@ -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");
---
```

Expand Down Expand Up @@ -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");
---
```

Expand Down Expand Up @@ -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");
---
```

Expand Down Expand Up @@ -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");
---
```

Expand Down