Fix API handler response termination logic (#22575)

This commit is contained in:
Omar López
2025-07-18 12:21:54 +00:00
committed by GitHub
parent dc5aef0dd4
commit f67522dbbd
+2 -2
View File
@@ -71,8 +71,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const redirectUrl = handler.redirect?.url ?? undefined;
res.json({ url: redirectUrl, newTab: handler.redirect?.newTab });
}
if (!res.writableEnded) return res.status(200);
return res;
if (!res.writableEnded) res.status(200);
return;
} catch (error) {
console.error(error);
if (error instanceof HttpError) {