diff options
Diffstat (limited to 'node_modules/undici/lib/cookies')
| -rw-r--r-- | node_modules/undici/lib/cookies/index.js | 7 | ||||
| -rw-r--r-- | node_modules/undici/lib/cookies/util.js | 35 |
2 files changed, 12 insertions, 30 deletions
diff --git a/node_modules/undici/lib/cookies/index.js b/node_modules/undici/lib/cookies/index.js index c9c1f28..f867b19 100644 --- a/node_modules/undici/lib/cookies/index.js +++ b/node_modules/undici/lib/cookies/index.js @@ -1,7 +1,7 @@ 'use strict' const { parseSetCookie } = require('./parse') -const { stringify, getHeadersList } = require('./util') +const { stringify } = require('./util') const { webidl } = require('../fetch/webidl') const { Headers } = require('../fetch/headers') @@ -77,14 +77,13 @@ function getSetCookies (headers) { webidl.brandCheck(headers, Headers, { strict: false }) - const cookies = getHeadersList(headers).cookies + const cookies = headers.getSetCookie() if (!cookies) { return [] } - // In older versions of undici, cookies is a list of name:value. - return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair)) + return cookies.map((pair) => parseSetCookie(pair)) } /** diff --git a/node_modules/undici/lib/cookies/util.js b/node_modules/undici/lib/cookies/util.js index 2290329..be3ccbe 100644 --- a/node_modules/undici/lib/cookies/util.js +++ b/node_modules/undici/lib/cookies/util.js @@ -1,8 +1,9 @@ 'use strict' -const assert = require('assert') -const { kHeadersList } = require('../core/symbols') - +/** + * @param {string} value + * @returns {boolean} + */ function isCTLExcludingHtab (value) { if (value.length === 0) { return false @@ -263,29 +264,11 @@ function stringify (cookie) { return out.join('; ') } -let kHeadersListNode - -function getHeadersList (headers) { - if (headers[kHeadersList]) { - return headers[kHeadersList] - } - - if (!kHeadersListNode) { - kHeadersListNode = Object.getOwnPropertySymbols(headers).find( - (symbol) => symbol.description === 'headers list' - ) - - assert(kHeadersListNode, 'Headers cannot be parsed') - } - - const headersList = headers[kHeadersListNode] - assert(headersList) - - return headersList -} - module.exports = { isCTLExcludingHtab, - stringify, - getHeadersList + validateCookieName, + validateCookiePath, + validateCookieValue, + toIMFDate, + stringify } |
