events-node: more reliable way to wait for 202 body to close

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-10-31 11:14:47 +01:00
parent 0b57aa1495
commit 1c7d10eea1
@@ -214,7 +214,10 @@ class PluginEventsService implements EventsService {
// immediately again
lock.release();
await res.body?.getReader()?.closed;
// We don't actually expect any response body here, but waiting for
// an empty body to be returned has been more reliable that waiting
// for the response body stream to close.
await res.text();
} else if (res.status === 200) {
const data = await res.json();
if (data) {