Skip to content

Commit c1717c9

Browse files
QTomclaude
andcommitted
fix(test): 测试连接收到 403 时将账号标记为 error 状态
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9f6ab6b commit c1717c9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

backend/internal/service/account_test_service.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,14 @@ func (s *AccountTestService) testClaudeAccountConnection(c *gin.Context, account
308308

309309
if resp.StatusCode != http.StatusOK {
310310
body, _ := io.ReadAll(resp.Body)
311-
return s.sendErrorAndEnd(c, fmt.Sprintf("API returned %d: %s", resp.StatusCode, string(body)))
311+
errMsg := fmt.Sprintf("API returned %d: %s", resp.StatusCode, string(body))
312+
313+
// 403 表示账号被上游封禁,标记为 error 状态
314+
if resp.StatusCode == http.StatusForbidden {
315+
_ = s.accountRepo.SetError(ctx, account.ID, errMsg)
316+
}
317+
318+
return s.sendErrorAndEnd(c, errMsg)
312319
}
313320

314321
// Process SSE stream

0 commit comments

Comments
 (0)