-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting all cookie package serialize/parse options #9063
Conversation
🦋 Changeset detectedLatest commit: d41b619 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thanks for the contribution @alex-sherwin! We don't normally like to expose dependency options like this, because it leaks an implementation detail. We would like to be able to swap out the serialization dependency without it being a breaking change in Astro. So, instead what I would suggest is adding the properties from CookieSerializeOptions that you need directly to AstroCookieSetOptions, so that it's part of our explicit API. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of inheriting from CookieSerializeOptions, just take the properties it has that we need.
Happy to make that change @matthewp But to clarify, you're receptive to exposing at least the I don't think that should be a problem, the barrier is low (the behavior now is to delegate to the |
@alex-sherwin Yeah, totally fine with exposing such an option, just didn't want to expose all of the dependencies' options for the backwards compat reason. |
Hello @alex-sherwin, was wondering if you planned to update this PR? |
Hi @matthewp, yes, I will plan to update it today |
@alex-sherwin up! ;) |
Great job getting this over the line @florian-lefebvre. We don't currently have a plan for the next minor, it will likely come around the new year. |
Docs PR: withastro/docs#6042 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for providing this, @matthewp ! Looks great! Just left some tiny suggestions for your consideration!
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a better suggestion for the changelog. The arrow function o => o
didn't tell us very much
Co-authored-by: Emanuele Stoppa <[email protected]>
Co-authored-by: Emanuele Stoppa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving on behalf of docs for the sake of completion/visibility!
This PR fixes #9062
AstroCookieSetOptions
to be based onCookieSerializeOptions
from the cookie package. All the Astro code was already passing the options provided directly to cookie'sserialize
function, so this is just a typing change.AstroCookieSetOptions
to be exported from the main astro package so it can be utilized by end-user codeAstroCookieGetOptions
based onCookieParseOptions
from the cookie package.Astro.cookies.get()
function to take an optionaloptions: AstroCookieGetOptions | undefined
which is passed down to the cookie package's parse functionAstro.cookies.has()
gets the same treatment asget
since it triggers cookie parsing