fix: close streaming responses after upstream errors

This commit is contained in:
tdurieux
2026-09-06 09:19:18 +02:00
parent 38a09188ad
commit b1cb9093bb
3 changed files with 20 additions and 2 deletions
+3
View File
@@ -39,6 +39,7 @@ router.post(
);
} catch (error) {
handleError(error, res);
if (res.headersSent && !res.writableEnded) res.destroy();
}
}
);
@@ -111,6 +112,8 @@ router.post("/", async (req: express.Request, res: express.Response) => {
content.destroy();
}
handleError(error, res);
if (res.headersSent && !res.writableEnded) res.destroy();
anonymizer.destroy();
}
content
.on("error", handleStreamError)