Skip to content
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

feat: add deleteCookie utility #66

Merged
merged 3 commits into from
Mar 11, 2022
Merged

feat: add deleteCookie utility #66

merged 3 commits into from
Mar 11, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Mar 11, 2022

resolves #46

@danielroe danielroe requested a review from pi0 March 11, 2022 09:35
@danielroe danielroe self-assigned this Mar 11, 2022
* deleteCookie(res, 'Authorization')
* ```
*/
export function deleteCookie (res: ServerResponse, name: string, serializeOptions?: Omit<CookieSerializeOptions, 'maxAge' | 'encode' | 'decode' | 'expires'>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be convenient allowing to pass these options even if not picked (to reuse same cookieOptions in different places)

* ```
*/
export function deleteCookie (res: ServerResponse, name: string, serializeOptions?: Omit<CookieSerializeOptions, 'maxAge' | 'encode' | 'decode' | 'expires'>) {
const cookieStr = serialize(name, '', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not reuse setCookie logic?

src/utils/cookie.ts Outdated Show resolved Hide resolved
@pi0 pi0 merged commit dd3c855 into main Mar 11, 2022
@pi0 pi0 deleted the feat/delete-cookie branch March 11, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

possible to delete a cookie?
2 participants