add guard against overlapping write misuse

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2025-08-06 14:13:22 +02:00
parent 1752be6b4b
commit 0571d97969
@@ -129,6 +129,12 @@ export function createResponseDataWriter(
});
return async data => {
if (drainPromise) {
throw new Error(
'Attempted overlapping write while waiting for previous write to drain',
);
}
if (res.write(data, 'utf8')) {
return 'ok';
}