From 96af7826dca69ee6f33a76d27cfa70793f1c1660 Mon Sep 17 00:00:00 2001 From: kujtimiihoxha Date: Fri, 19 Sep 2025 10:50:30 +0200 Subject: [PATCH] Revert "refactor(tidy): remove nested if and else block" This reverts commit a6e99fff52b4ab105df91f595a6e94ff3e8bd2cb. --- internal/config/config.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 4e12218d37bf23aa9b80bb91d4e653493088dc86..67378e9ff00356358bfedd403aacd655b763cfc6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -546,12 +546,15 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error { if err != nil { return fmt.Errorf("failed to create request for provider %s: %w", c.ID, err) } - if c.ID == string(catwalk.InferenceProviderZAI) && b.StatusCode == http.StatusUnauthorized { - // for z.ai just check if the http response is not 401 - return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status) - } - if b.StatusCode != http.StatusOK { - return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status) + if c.ID == string(catwalk.InferenceProviderZAI) { + if b.StatusCode == http.StatusUnauthorized { + // for z.ai just check if the http response is not 401 + return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status) + } + } else { + if b.StatusCode != http.StatusOK { + return fmt.Errorf("failed to connect to provider %s: %s", c.ID, b.Status) + } } _ = b.Body.Close() return nil