From 5d1b4378bb45e4b6c84b54ccd7a61985581a844f Mon Sep 17 00:00:00 2001 From: Daniel Bretoi Date: Fri, 8 Apr 2016 10:31:47 -0700 Subject: [PATCH] test for strictHeader false --- test/state.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/state.js b/test/state.js index ec9e75730..09b02ba9b 100755 --- a/test/state.js +++ b/test/state.js @@ -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) {