Skip to content

Commit

Permalink
tests: add res.writeHead set-cookie test
Browse files Browse the repository at this point in the history
closes #746
  • Loading branch information
ghinks authored and dougwilson committed Jul 7, 2020
1 parent e485e11 commit 7d7f4f7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/session.js
Expand Up @@ -1892,6 +1892,21 @@ describe('session()', function(){
.expect(shouldSetCookieToValue('previous', 'cookieValue'))
.expect(200, done)
})

it('should preserve cookies set in writeHead', function (done) {
var server = createServer(null, function (req, res) {
var cookie = new Cookie()
res.writeHead(200, {
'Set-Cookie': cookie.serialize('previous', 'cookieValue')
})
res.end()
})

request(server)
.get('/')
.expect(shouldSetCookieToValue('previous', 'cookieValue'))
.expect(200, done)
})
})

describe('.originalMaxAge', function () {
Expand Down

0 comments on commit 7d7f4f7

Please sign in to comment.