diff --git a/lib/utils/routes.js b/lib/utils/routes.js index ef7b21663b..a6166132c5 100644 --- a/lib/utils/routes.js +++ b/lib/utils/routes.js @@ -22,7 +22,7 @@ function routes(server) { createReadStream(join(clientBasePath, 'default/index.bundle.js')).pipe(res); }); - app.get('/invalidate', (_req, res) => { + app.get('/webpack-dev-server/invalidate', (_req, res) => { server.invalidate(); res.end(); }); diff --git a/test/server/utils/routes.test.js b/test/server/utils/routes.test.js index ae2597b12f..1fdd441748 100644 --- a/test/server/utils/routes.test.js +++ b/test/server/utils/routes.test.js @@ -48,8 +48,12 @@ describe('routes util', () => { }); }); - it('GET request to invalidate endpoint', (done) => { - req.get('/invalidate').expect(200, done); + it('should handles GET request to invalidate endpoint', (done) => { + req.get('/webpack-dev-server/invalidate').then(({ res }) => { + expect(res.headers['content-type']).not.toEqual('text/html'); + expect(res.statusCode).toEqual(200); + done(); + }); }); it('should handles GET request to live html', (done) => {