diff --git a/packages/gasket-plugin-express/lib/create-servers.js b/packages/gasket-plugin-express/lib/create-servers.js index 1288c283e..f13932885 100644 --- a/packages/gasket-plugin-express/lib/create-servers.js +++ b/packages/gasket-plugin-express/lib/create-servers.js @@ -8,6 +8,7 @@ */ module.exports = async function createServers(gasket, serverOpts) { const app = gasket.actions.getExpressApp(); + app.use(require('cookie-parser')()); await gasket.exec('express', app); diff --git a/packages/gasket-plugin-express/test/plugin.test.js b/packages/gasket-plugin-express/test/plugin.test.js index d850a3726..24a9b6446 100644 --- a/packages/gasket-plugin-express/test/plugin.test.js +++ b/packages/gasket-plugin-express/test/plugin.test.js @@ -86,6 +86,11 @@ describe('createServers', () => { expect(result).toEqual({ handler: bridgedApp }); }); + it('attaches cookie parser middleware', async function () { + await plugin.hooks.createServers(gasket, {}); + expect(app.use).toHaveBeenCalledWith(cookieParserMiddleware); + }); + it('executes the `express` lifecycle', async function () { await plugin.hooks.createServers(gasket, {}); expect(gasket.exec).toHaveBeenCalledWith('express', app);