From 0f9407dc31820b28dc88581b0d46366748f54b59 Mon Sep 17 00:00:00 2001 From: WongXX Date: Mon, 27 Jan 2025 17:04:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=B9=BE=E6=A2=9D=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.ts b/index.ts index 352ede2..0d86db3 100644 --- a/index.ts +++ b/index.ts @@ -14,9 +14,11 @@ fs.watch(path, async function (event, filename) { if (requestData.Processed === true) return const method: any = requestData.Request.Mode.toUpperCase() if (!['GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE'].includes(method)) { + console.error('無效的請求方式') return } requestData.Response = {Headers: {}} + console.log(`接收到請求:${filename} => ${method} ${requestData.Request.URL}`) try { const res = await got({ url: requestData.Request.URL, @@ -35,6 +37,7 @@ fs.watch(path, async function (event, filename) { requestData.Response.StatusCode = error.response.statusCode } else { requestData.Response.StatusCode = -1 + console.error(`處理失敗:${filename}\n`, error) } } requestData.Processed = true