Skip to content

Commit

Permalink
don't use internal header state for cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed May 22, 2024
1 parent eed423a commit 58696f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
7 changes: 3 additions & 4 deletions lib/web/cookies/index.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down Expand Up @@ -78,14 +78,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))
}

/**
Expand Down
8 changes: 0 additions & 8 deletions lib/web/fetch/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,6 @@ Object.defineProperties(Headers.prototype, {
},
[util.inspect.custom]: {
enumerable: false
},
// Compatibility for global headers
[Symbol('headers list')]: {
configurable: false,
enumerable: false,
get: function () {
return getHeadersList(this)
}
}
})

Expand Down

0 comments on commit 58696f3

Please sign in to comment.