feat: 新增错误模拟功能

This commit is contained in:
zhaoyingbo 2025-03-20 06:59:19 +00:00
parent 8385b12886
commit 277963436b

View File

@ -50,6 +50,12 @@ const bunServer = Bun.serve({
if (path.startsWith("/v1")) return manageModelProxyReq(ctx)
// 健康检查
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")
// 其他
return genResp.healthCheck("hello, there is egg, glade to serve you!")
} catch (error: any) {