fix: Make sure if header is set already, it isn't set again (#12194)

This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-11-02 09:22:16 -03:00
1 parent 9348279818
commit d8356e9a5b
1 file changed
+3 -1
+3 -1
View File
@@ -13,7 +13,9 @@ export function defaultResponder<T>(f: Handle<T>) {
performance.mark("Start");
const result = await f(req, res);
ok = true;
if (result) res.json(result);
if (result && !res.writableEnded) {
res.json(result);
}
} catch (err) {
console.error(err);
const error = getServerErrorFromUnknown(err);