Skip to content

Commit

Permalink
chore: improve jsdoc in cookies (#3478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Aug 19, 2024
1 parent d5c9c05 commit 1c5c954
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions lib/web/cookies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const { Headers } = require('../fetch/headers')
* @typedef {Object} Cookie
* @property {string} name
* @property {string} value
* @property {Date|number|undefined} expires
* @property {number|undefined} maxAge
* @property {string|undefined} domain
* @property {string|undefined} path
* @property {boolean|undefined} secure
* @property {boolean|undefined} httpOnly
* @property {'Strict'|'Lax'|'None'} sameSite
* @property {string[]} unparsed
* @property {Date|number} [expires]
* @property {number} [maxAge]
* @property {string} [domain]
* @property {string} [path]
* @property {boolean} [secure]
* @property {boolean} [httpOnly]
* @property {'Strict'|'Lax'|'None'} [sameSite]
* @property {string[]} [unparsed]
*/

/**
Expand All @@ -29,6 +29,8 @@ function getCookies (headers) {
webidl.brandCheck(headers, Headers, { strict: false })

const cookie = headers.get('cookie')

/** @type {Record<string, string>} */
const out = {}

if (!cookie) {
Expand Down
2 changes: 1 addition & 1 deletion lib/web/cookies/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const assert = require('node:assert')
* @description Parses the field-value attributes of a set-cookie header string.
* @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
* @param {string} header
* @returns if the header is invalid, null will be returned
* @returns {import('./index').Cookie|null} if the header is invalid, null will be returned
*/
function parseSetCookie (header) {
// 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F
Expand Down

0 comments on commit 1c5c954

Please sign in to comment.