Skip to content

Commit 6895027

Browse files
c-c-eprCopilot
andcommitted
chore: 更新註解以說明 Zeabur 錯誤處理邏輯
Co-authored-by: Copilot <copilot@github.com>
1 parent 59c04fe commit 6895027

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/router.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ export async function router(request: Request, env: Env, ctx: ExecutionContext)
55
return new Response("Method Not Allowed", { status: 405 });
66
}
77

8-
//////////////////////////////////////////////
9-
//此段應該在 Zeabur 修復 Bug 後移除
10-
console.log(request.headers.get("X-ZSend-Event"));
8+
// 此例外應該在 Zeabur 修復 Bug 後移除,請參考 README.md 中的說明
9+
// This exception should be removed after Zeabur fixes the bug, please refer to the README.md for details
1110
if (request.headers.get("X-ZSend-Event") === "test") {
11+
console.log("[TEST] Skip signature verification due to Zeabur bug");
1212
return new Response("OK!");
1313
}
14-
//////////////////////////////////////////////
1514

1615
const secret = env.SECRET_KEY;
1716
if (!secret) {
@@ -43,11 +42,13 @@ export async function router(request: Request, env: Env, ctx: ExecutionContext)
4342
if (signature !== `sha256=${expectedSignature}`) {
4443
return new Response("Invalid signature", { status: 401 });
4544
}
45+
console.log(request.headers.get("X-ZSend-Event"));
4646

4747
// 非同步執行
4848
ctx.waitUntil(
4949
(async () => {
50-
// console.log('Doing some work in the background...');
50+
// 在這裡可以做一些背景工作
51+
// You can do some work in the background here
5152
})(),
5253
);
5354
// 回傳成功

0 commit comments

Comments
 (0)