Since .getSetCookie() was introduced, HeaderList has an additional .cookies field, which is not updated on .clear():
|
clear () { |
|
this[kHeadersMap].clear() |
|
this[kHeadersSortedMap] = null |
|
} |
This is observable:
const req1 = new undici.Request('http://localhost', {
headers: {
'set-cookie': 'a=1'
}
});
console.log([...req1.headers]); // --> [ [ 'set-cookie', 'a=1' ] ]
const req2 = new undici.Request(req1, {
headers: {}
});
console.log([...req2.headers]); // --> []
console.log(req2.headers.getSetCookie()); // --> [ 'a=1' ] - unexpected!
Since
.getSetCookie()was introduced,HeaderListhas an additional.cookiesfield, which is not updated on.clear():undici/lib/fetch/headers.js
Lines 95 to 98 in 816dcaa
This is observable: