diff --git a/index.ts b/index.ts index 856da20..d673b05 100644 --- a/index.ts +++ b/index.ts @@ -51,10 +51,11 @@ const bunServer = Bun.serve({ // 健康检查 if (path.full("/health")) return genResp.healthCheck() // 错误模拟 - if (path.full("/mock/400")) return genResp.badRequest("模拟错误400") - if (path.full("/mock/403")) return genResp.forbidden("模拟错误403") - if (path.full("/mock/404")) return genResp.notFound("模拟错误404") - if (path.full("/mock/500")) return genResp.serverError("模拟错误500") + if (path.startsWith("/mock/400")) return genResp.badRequest("模拟错误400") + if (path.startsWith("/mock/403")) return genResp.forbidden("模拟错误403") + if (path.startsWith("/mock/404")) return genResp.notFound("模拟错误404") + if (path.startsWith("/mock/500")) + return genResp.serverError("模拟错误500") // 其他 return genResp.healthCheck("hello, there is egg, glade to serve you!")