mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
f33fe3190b
* #9062: allow setting all cookie package serialize/parse options * 9062: fix scripts to original arrangement * feat: only add specific properties * Update tiny-days-dance.md * Add examples to the changeset * Update .changeset/tiny-days-dance.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/tiny-days-dance.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/tiny-days-dance.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * Update .changeset/tiny-days-dance.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> --------- Co-authored-by: Arsh <69170106+lilnasy@users.noreply.github.com> Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: Matthew Phillips <matthew@matthewphillips.info> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
730 B
730 B
astro |
---|
minor |
Cookie encoding / decoding can now be customized
Adds new encode
and decode
functions to allow customizing how cookies are encoded and decoded. For example, you can bypass the default encoding via encodeURIComponent
when adding a URL as part of a cookie:
---
import { encodeCookieValue } from "./cookies";
Astro.cookies.set('url', Astro.url.toString(), {
// Override the default encoding so that URI components are not encoded
encode: value => encodeCookieValue(value)
});
---
Later, you can decode the URL in the same way:
---
import { decodeCookieValue } from "./cookies";
const url = Astro.cookies.get('url', {
decode: value => decodeCookieValue(value)
});
---