Skip to content

docs: update res.clearCookie documentation for clarity and accuracy #2000

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

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion _includes/api/en/4x/res-clearCookie.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<h3 id='res.clearCookie'>res.clearCookie(name [, options])</h3>

Clears the cookie specified by `name`. For details about the `options` object, see [res.cookie()](#res.cookie).
Clears the cookie with the specified `name` by sending a `Set-Cookie` header that sets its expiration date in the past.
This instructs the client that the cookie has expired and is no longer valid. For more information
about available `options`, see [res.cookie()](#res.cookie).

<div class="doc-box doc-warn" markdown="1">
If the `maxAge` or `expires` options are set, the cookie may not be cleared depending on the time values provided,
as Express does not ignore these options. It is therefore recommended to omit these options when calling this
method. Passing these two options has been deprecated since Express v4.20.0.
</div>

<div class="doc-box doc-notice" markdown="1">
Web browsers and other compliant clients will only clear the cookie if the given
Expand Down
11 changes: 8 additions & 3 deletions _includes/api/en/5x/res-clearCookie.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<h3 id='res.clearCookie'>res.clearCookie(name [, options])</h3>

Clears the cookie specified by `name`. For details about the `options` object, see [res.cookie()](#res.cookie).
Clears the cookie with the specified `name` by sending a `Set-Cookie` header that sets its expiration date in the past.
This instructs the client that the cookie has expired and is no longer valid. For more information
about available `options`, see [res.cookie()](#res.cookie).

<div class="doc-box doc-notice" markdown="1">
The `expires` and `max-age` options are being ignored completely.
</div>

<div class="doc-box doc-notice" markdown="1">
Web browsers and other compliant clients will only clear the cookie if the given
`options` is identical to those given to [res.cookie()](#res.cookie), excluding
`expires` and `maxAge`.
`options` is identical to those given to [res.cookie()](#res.cookie)
</div>

```js
Expand Down