Skip to content

Commit

Permalink
test for strictHeader false
Browse files Browse the repository at this point in the history
  • Loading branch information
danielb2 committed Apr 8, 2016
1 parent 8aef93a commit 5d1b437
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ describe('state', () => {
});
});

it('ignores invalid cookie using server.state() (header)', (done) => {

const handler = function (request, reply) {

const log = request.getLog('state');
return reply(log.length);
};

const server = new Hapi.Server();
server.connection();
server.state('a', { strictHeader: false });
server.route({ path: '/', method: 'GET', handler: handler });
server.inject({ method: 'GET', url: '/', headers: { cookie: 'a=x y;' } }, (res) => {

expect(res.statusCode).to.equal(200);
expect(res.result).to.equal(0);
done();
});
});

it('logs invalid cookie (value)', (done) => {

const handler = function (request, reply) {
Expand Down

0 comments on commit 5d1b437

Please sign in to comment.