Skip to content

Commit

Permalink
fix: ensure cookies are parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
agerard-godaddy committed Dec 19, 2024
1 parent 8d7dfee commit 0ce37a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/gasket-plugin-express/lib/create-servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions packages/gasket-plugin-express/test/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0ce37a6

Please sign in to comment.