Skip to content

Commit

Permalink
Bug #818 Assert mutiple set-cookie headers are included in object
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwsperber committed Feb 7, 2017
1 parent 6b54bdb commit 20dceeb
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/test_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,40 @@ tap.test('stringifyRequest', function (t) {

t.end();
});


tap.test('headersArrayToObject', function (t) {
var headers = [
"Content-Type",
"application/json; charset=utf-8",
"Last-Modified",
"foobar",
"Expires",
"fizbuzz"
];

t.deepEqual(common.headersArrayToObject(headers), {
"Content-Type": "application/json; charset=utf-8",
"Last-Modified": "foobar",
"Expires": "fizbuzz"
});

var headersMultipleSetCookies = headers.concat([
"Set-Cookie",
"foo=bar; Domain=.github.jparrowsec.cn; Path=/",
"Set-Cookie",
"fiz=baz; Domain=.github.jparrowsec.cn; Path=/"
]);

t.deepEqual(common.headersArrayToObject(headersMultipleSetCookies), {
"Content-Type": "application/json; charset=utf-8",
"Last-Modified": "foobar",
"Expires": "fizbuzz",
"Set-Cookie": [
"foo=bar; Domain=.github.jparrowsec.cn; Path=/",
"fiz=baz; Domain=.github.jparrowsec.cn; Path=/"
]
});

t.end();
});

0 comments on commit 20dceeb

Please sign in to comment.