From dea0dca4e4a51bdb92e859c109169b22552056fd Mon Sep 17 00:00:00 2001 From: martin-mfg <2026226+martin-mfg@users.noreply.github.com> Date: Thu, 26 Jun 2025 10:17:11 +0000 Subject: [PATCH] fix repeat-recent code --- _dot_vercel_copy/output/functions/api.func/router.js | 4 ---- api-renamed/repeat-recent.js | 9 ++++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/_dot_vercel_copy/output/functions/api.func/router.js b/_dot_vercel_copy/output/functions/api.func/router.js index 1389f27d..24d7b546 100644 --- a/_dot_vercel_copy/output/functions/api.func/router.js +++ b/_dot_vercel_copy/output/functions/api.func/router.js @@ -19,10 +19,6 @@ export default async (req, res) => { res.end(String(data)); } }; - res.status = function (code) { - res.statusCode = code; - return res; - }; const url = new URL(req.url, "https://localhost"); req.query = Object.fromEntries(url.searchParams.entries()); diff --git a/api-renamed/repeat-recent.js b/api-renamed/repeat-recent.js index 148b46f1..888e3b5b 100644 --- a/api-renamed/repeat-recent.js +++ b/api-renamed/repeat-recent.js @@ -2,13 +2,16 @@ import { repeatRecentRequests } from "../src/common/database.js"; export default async (req, res) => { if (req.method !== "POST") { - res.status(405).json({ error: "Method Not Allowed" }); + res.statusCode = 405; + res.send({ error: "Method Not Allowed" }); return; } try { await repeatRecentRequests(); - res.status(200).json({ message: "Recent requests repeated successfully." }); + res.statusCode = 200; + res.send({ message: "Recent requests repeated successfully." }); } catch (error) { - res.status(500).json({ error: error.message || "Internal Server Error" }); + res.statusCode = 500; + res.send({ error: error.message || "Internal Server Error" }); } };