Skip to content

Commit 54b99d0

Browse files
fix[modules-config](socai): fixed providers configuration
1 parent 9bda781 commit 54b99d0

File tree

1 file changed

+4
-3
lines changed
  • plugins/modules-config/validations

1 file changed

+4
-3
lines changed

plugins/modules-config/validations/socai.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var providerDefaultURLs = map[string]string{
4040
"groq": "https://api.groq.com/openai/v1/chat/completions",
4141
}
4242

43+
4344
var providerDisplayNames = map[string]string{
4445
"openai": "OpenAI",
4546
"anthropic": "Anthropic",
@@ -166,10 +167,10 @@ func testSOCAIConnection(socai SOCAIConfig) error {
166167
}
167168

168169
// Test connection with GET request (most APIs return error but validate auth)
169-
_, status, err := utils.DoReq[map[string]any](socai.URL, nil, "GET", headers, false)
170+
_, status, err := utils.DoReq[map[string]any](socai.URL, nil, "POST", headers, false)
170171

171172
switch status {
172-
case http.StatusOK, http.StatusMethodNotAllowed, http.StatusBadRequest:
173+
case http.StatusOK, http.StatusBadRequest:
173174
// These are acceptable - means we reached the API and auth worked
174175
return nil
175176
case http.StatusUnauthorized:
@@ -182,7 +183,7 @@ func testSOCAIConnection(socai SOCAIConfig) error {
182183
return fmt.Errorf("Invalid API Key for %s. Please verify your API Key is correct.", providerName)
183184
case http.StatusForbidden:
184185
return fmt.Errorf("%s API Key does not have the required permissions (HTTP 403). Please verify the API Key has access to the chat completions endpoint.", providerName)
185-
case http.StatusNotFound:
186+
case http.StatusNotFound, http.StatusMethodNotAllowed:
186187
if socai.Provider == "azure" {
187188
return fmt.Errorf("Azure OpenAI endpoint not found (HTTP 404). Please verify your Endpoint URL includes the correct resource name and deployment.")
188189
}

0 commit comments

Comments
 (0)