From 336d5c22b0cd89ccbdf64843b74a17c1d7af37a9 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 6 Mar 2019 17:17:28 +0100 Subject: [PATCH] Fix overwrite Content-Type test The headers get set *after* Content-Type already got overwritten. Hence the test is not testing whether the Content-Type overwrite is actually skipped. --- test/tests/server.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/tests/server.js b/test/tests/server.js index 36f7cd0fc..37dae60a0 100644 --- a/test/tests/server.js +++ b/test/tests/server.js @@ -262,18 +262,21 @@ describe('Server', () => { describe('custom Content-Type', () => { before((done) => { app = express(); + app.use((req, res, next) => { + res.set('Content-Type', 'application/octet-stream'); + next(); + }); const compiler = webpack(webpackConfig); instance = middleware(compiler, { stats: 'errors-only', - logLevel, - headers: { 'Content-Type': 'application/octet-stream' } + logLevel }); app.use(instance); listen = listenShorthand(done); }); after(close); - it('Do not guess mime type if Content-Type header is found ', (done) => { + it('Do not guess mime type if Content-Type header is found', (done) => { request(app).get('/bundle.js') .expect('Content-Type', 'application/octet-stream') .expect(200, done);