From 56792b7bc59fb52c7bf14a1b32cd75cd4b1f48e5 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Tue, 30 Apr 2019 09:44:39 -0500 Subject: [PATCH] Add invalidate endpoint --- lib/Server.js | 5 +++++ test/Routes.test.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/Server.js b/lib/Server.js index 7b5d76557e..8dd2692942 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -299,6 +299,11 @@ class Server { res.end(''); }); + app.get('/invalidate', (_req, res) => { + this.invalidate(); + res.end(); + }); + let contentBase; if (options.contentBase !== undefined) { diff --git a/test/Routes.test.js b/test/Routes.test.js index e3322ff242..4174bf7715 100644 --- a/test/Routes.test.js +++ b/test/Routes.test.js @@ -33,6 +33,10 @@ describe('Routes', () => { .expect(200, done); }); + it('GET request to invalidate endpoint', (done) => { + req.get('/invalidate').expect(200, done); + }); + it('GET request to live bundle', (done) => { req .get('/__webpack_dev_server__/live.bundle.js')