diff --git a/base-server/index.js b/base-server/index.js index 5408399..fe64dcd 100644 --- a/base-server/index.js +++ b/base-server/index.js @@ -628,6 +628,7 @@ export class BaseServer { if (this.destroying) { res.writeHead(503, { 'Content-Type': 'text/plain' }) res.end('The server is shutting down\n') + return } let urlString = req.url diff --git a/base-server/index.test.ts b/base-server/index.test.ts index 2962176..bb5f111 100644 --- a/base-server/index.test.ts +++ b/base-server/index.test.ts @@ -1712,6 +1712,10 @@ it('waits until all HTTP processing ends', async () => { await setTimeout(100) expect(destroyed).toBe(false) + expect((await requestError(app, 'POST', '/a')).message).toEqual( + 'The server is shutting down\n' + ) + resolveA!() await setTimeout(100) expect(destroyed).toBe(false)