screenci dev: tolerate empty poll responses instead of warning

An empty 2xx body from the /cli/dev/* proxy (or an idle keep-alive) made
postDev's res.json() throw "Unexpected end of JSON input", which the poll loop
logged as "Connection problem, retrying" and backed off on. Read the body as
text and treat an empty one as an empty result, so an empty poll response is a
no-op instead of a spurious connection error.
This commit is contained in:
Olli Paloviita
2026-07-08 19:28:13 +03:00
parent 2c7e4f4781
commit 7f18152cab
2 changed files with 25 additions and 3 deletions
+9
View File
@@ -103,6 +103,15 @@ describe('pollDevListener', () => {
await expect(pollDevListener(config, deps, 'lst_1')).resolves.toBeNull()
})
it('treats an empty 2xx body as no trigger instead of throwing', async () => {
const deps = makeDeps()
// The /cli/dev/* proxy (or an idle keep-alive) can return an empty body;
// res.json() on it throws "Unexpected end of JSON input".
deps.fetchMock.mockResolvedValueOnce(new Response('', { status: 200 }))
await expect(pollDevListener(config, deps, 'lst_1')).resolves.toBeNull()
})
})
describe('runDevListenLoop', () => {