-
Notifications
You must be signed in to change notification settings - Fork 781
Open
Labels
Description
Describe the bug
Node.js version: 16, but reproduced with 20 and 24 too.
OS version: Ubuntu 24.04
Description: cookie names are converted to lower case.
Actual behavior
Given an app which sets a cookie Foo=bar:
app.get('/v1/myroute', (req, res) => {
// Set a cookie with a mixed-case name
res.cookie('Foo', 'bar');
res.json({ message: 'Cookie set' });
});When I write a test to expect the cookie Foo:
const res = await request(app)
.get('/v1/myroute/')
.set('Accept', 'application/json')
.expect(200)
.expect(cookies.new({name: 'Foo', value: 'bar'}));And I run npm test:
Error: expected: Foo cookie to be set
Then the test fails.
Expected behavior
The test passes.
Code to reproduce
See this code reproducer: https://github.com/caarmen/supertest-cookie-issue/tree/main
And a failing test PR: #880
Checklist
- I have searched through GitHub issues for similar issues.
- I have completely read through the README and documentation.
- I read the cookies part in more detail, kind of skimmed through the rest of the README.
- I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
Reactions are currently unavailable