Skip to content

Commit

Permalink
fix: compatibility for global headers (nodejs#3286)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsctx authored May 21, 2024
1 parent af3379f commit 064b08d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/web/fetch/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,6 @@ Reflect.deleteProperty(Headers, 'setHeadersGuard')
Reflect.deleteProperty(Headers, 'getHeadersList')
Reflect.deleteProperty(Headers, 'setHeadersList')

Object.defineProperty(Headers.prototype, util.inspect.custom, {
enumerable: false
})

iteratorMixin('Headers', Headers, kHeadersSortedMap, 0, 1)

Object.defineProperties(Headers.prototype, {
Expand All @@ -642,6 +638,17 @@ Object.defineProperties(Headers.prototype, {
[Symbol.toStringTag]: {
value: 'Headers',
configurable: true
},
[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 064b08d

Please sign in to comment.