-
Notifications
You must be signed in to change notification settings - Fork 783
Test for cookie case #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Test for cookie case #882
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1281,4 +1281,26 @@ describe('cookie', function () { | |
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Cookie name case is respected', function () { | ||
| it('asserts true if cookie name contains capital letters', function () { | ||
| const app = express(); | ||
| app.get('/users', function(req, res) { | ||
| res.cookie('Alpha', 'one', { domain: 'domain.com', path: '/', httpOnly: true }); | ||
| res.send(200, { name: 'tobi' }); | ||
| }); | ||
| request(app) | ||
| .get('/users') | ||
| .expect('Content-Type', /json/) | ||
| .expect('Content-Length', '15') | ||
| .expect(200) | ||
| // assert 'Alpha' cookie is set with domain, path, and httpOnly options | ||
| .expect(cookies.set({ name: 'Alpha', options: ['domain', 'path', 'httponly'] })) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmurvihill could you share more details about this code, please? In standard Supertest, you cannot pass an object like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| .end(function(err, res) { | ||
| if (err) { | ||
| throw err; | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this version of code to make it clearer:
describe('Cookie Case Sensitivity', function () {it('should respect capital letters in cookie names', async function () {There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to
respects case of cookie nameand moved up with the rest of the tests for.set.