Skip to content

Commit

Permalink
Added docs for res.cookie partitioned option
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Jan 29, 2024
1 parent 7128e02 commit b025f7f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions _includes/api/en/4x/res-cookie.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ Sets cookie `name` to `value`. The `value` parameter may be a string or object

The `options` parameter is an object that can have the following properties.

| Property | Type | Description |
|-------------|-------------------------------------------------------------------------|
| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app.
| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.
| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.
| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server.
| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds.
| `path` | String | Path for the cookie. Defaults to "/".
| `priority` | String | Value of the "Priority" **Set-Cookie** attribute.
| `secure` | Boolean | Marks the cookie to be used with HTTPS only.
| `signed` | Boolean | Indicates if the cookie should be signed.
| `sameSite` | Boolean or String | Value of the "SameSite" **Set-Cookie** attribute. More information at [https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1).
| Property | Type | Description |
|---------------|-------------------------------------------------------------------------|
| `domain` | String | Domain name for the cookie. Defaults to the domain name of the app.
| `encode` | Function | A synchronous function used for cookie value encoding. Defaults to `encodeURIComponent`.
| `expires` | Date | Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie.
| `httpOnly` | Boolean | Flags the cookie to be accessible only by the web server.
| `maxAge` | Number | Convenient option for setting the expiry time relative to the current time in milliseconds.
| `path` | String | Path for the cookie. Defaults to "/".
| `partitioned` | Boolean | Indicates that the cookie should be stored using partitioned storage. See [Cookies Having Independent Partitioned State (CHIPS)](https://developer.mozilla.org/en-US/docs/Web/Privacy/Partitioned_cookies) for more details.
| `priority` | String | Value of the "Priority" **Set-Cookie** attribute.
| `secure` | Boolean | Marks the cookie to be used with HTTPS only.
| `signed` | Boolean | Indicates if the cookie should be signed.
| `sameSite` | Boolean or String | Value of the "SameSite" **Set-Cookie** attribute. More information at [https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1).

<div class="doc-box doc-notice" markdown="1">
All `res.cookie()` does is set the HTTP `Set-Cookie` header with the options provided.
Expand Down

0 comments on commit b025f7f

Please sign in to comment.