feat: 新增错误模拟功能
This commit is contained in:
parent
8385b12886
commit
277963436b
6
index.ts
6
index.ts
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user