add guard against overlapping write misuse
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user