mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-26 08:31:55 +00:00
test: cover billing override on HTTP 401
This commit is contained in:
@@ -527,6 +527,15 @@ describe("failover-error", () => {
|
||||
).toBe("billing");
|
||||
});
|
||||
|
||||
it("401 billing-style message returns billing instead of generic auth", () => {
|
||||
expect(
|
||||
resolveFailoverReasonFromError({
|
||||
status: 401,
|
||||
message: "401 Key limit exceeded (monthly limit)",
|
||||
}),
|
||||
).toBe("billing");
|
||||
});
|
||||
|
||||
it("resolveFailoverStatus maps auth_permanent to 403", () => {
|
||||
expect(resolveFailoverStatus("auth_permanent")).toBe(403);
|
||||
});
|
||||
|
||||
@@ -570,6 +570,12 @@ describe("classifyFailoverReasonFromHttpStatus", () => {
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("lets billing-classified HTTP 401 responses bypass generic auth", () => {
|
||||
expect(
|
||||
classifyFailoverReasonFromHttpStatus(401, "401 Key limit exceeded (monthly limit)"),
|
||||
).toBe("billing");
|
||||
});
|
||||
|
||||
it("treats HTTP 499 as transient for structured errors", () => {
|
||||
expect(classifyFailoverReasonFromHttpStatus(499)).toBe("timeout");
|
||||
expect(classifyFailoverReasonFromHttpStatus(499, "499 Client Closed Request")).toBe("timeout");
|
||||
|
||||
Reference in New Issue
Block a user