Skip to content

Reading set-cookie header in node-fetch response returns default value #2076

@louy

Description

@louy

Describe the bug

When making a fetch request using this library, reading the set-cookie header in the response via Headers.get method doesn't work, unless Headers._map is initialised (via a different reading mechanism.)

To Reproduce Steps to reproduce the behavior:

import {Headers} from '@whatwg-node/node-fetch'

const headers = new Headers({
  'set-cookie': ['a=b', 'c=d'],
});
console.log(headers.get('set-cookie'))
headers.getMap();
console.log(headers.get('set-cookie'))

Produces:


a=b,c=d

Expected behavior

a=b,c=d
a=b,c=d

Environment:

  • OS: MacOS
  • @whatwg-node/node-fetch: 0.7.9
  • NodeJS: v22.11.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions