summaryrefslogtreecommitdiff
path: root/.changeset/twenty-cheetahs-deny.md
blob: 38a7298bf81aacd24f60d09919b281c5586c0db6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
'astro': major
---

Astro.cookies.get(key) returns undefined if cookie doesn't exist

With this change, Astro.cookies.get(key) no longer always returns a `AstroCookie` object. Instead it now returns `undefined` if the cookie does not exist.

You should update your code if you assume that all calls to `get()` return a value. When using with `has()` you still need to assert the value, like so:

```astro
---
if(Astro.cookies.has(id)) {
  const id = Astro.cookies.get(id)!;
}
---
```