Describe the bug
Node.js version: v24.10.0
OS version: macOS 15.7.3
Description:
If a response contains a Content-Type header with header=(anything), header matching breaks for all headers. This is relevant to text/csv responses, which can contain header=present or header=absent.
Actual behavior
Expectations fail with expected "..." header field (see full output below)
Expected behavior
Other headers are not affected by content-type parameters.
Code to reproduce
import request from 'supertest';
import { createServer } from 'node:http';
const s = createServer((_, res) => {
res.setHeader('foo', 'a');
res.setHeader('content-type', 'text/csv; header=a');
res.end();
});
await new Promise((resolve) => s.listen(0, '127.0.0.1', resolve));
await request(s).get('/').expect(200).expect('foo', 'a');
Error: expected "foo" header field
at file://[...]/experiment.js:11:39
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
----
at Test._assertHeader ([...]/node_modules/supertest/lib/test.js:281:47)
at [...]/node_modules/supertest/lib/test.js:365:13
at Test._assertFunction ([...]/node_modules/supertest/lib/test.js:342:13)
at Test.assert ([...]/node_modules/supertest/lib/test.js:195:23)
at localAssert ([...]/node_modules/supertest/lib/test.js:138:14)
at [...]/node_modules/supertest/lib/test.js:156:7
at Request.callback ([...]/node_modules/superagent/lib/node/index.js:847:12)
at IncomingMessage.<anonymous> ([...]/node_modules/superagent/lib/node/index.js:1102:18)
at IncomingMessage.emit (node:events:520:35)
at endReadableNT (node:internal/streams/readable:1701:12)
Removing or renaming header=a in the content-type header, or renaming the content-type header to any other name, causes the issue to go away.
Checklist
Describe the bug
Node.js version: v24.10.0
OS version: macOS 15.7.3
Description:
If a response contains a
Content-Typeheader withheader=(anything), header matching breaks for all headers. This is relevant totext/csvresponses, which can containheader=presentorheader=absent.Actual behavior
Expectations fail with
expected "..." header field(see full output below)Expected behavior
Other headers are not affected by
content-typeparameters.Code to reproduce
Removing or renaming
header=ain thecontent-typeheader, or renaming thecontent-typeheader to any other name, causes the issue to go away.Checklist