Skip to content

Commit ed23b7d

Browse files
authored
fix: use http 422 instead of 407 during model provider validation so that the error shows up properly (#1698)
1 parent bd59c08 commit ed23b7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/api/handlers/modelprovider.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ func (mp *ModelProviderHandler) Validate(req api.Context) error {
180180
ref.Name,
181181
)
182182
}
183-
return types.NewErrHttp(http.StatusProxyAuthRequired, strings.Trim(err.Error(), "\"'"))
183+
return types.NewErrHttp(http.StatusUnprocessableEntity, strings.Trim(err.Error(), "\"'"))
184184
}
185185

186186
var validationError ValidationError
187187
if json.Unmarshal([]byte(res.Output), &validationError) == nil && validationError.Err != "" {
188-
return types.NewErrHttp(http.StatusProxyAuthRequired, validationError.Error())
188+
return types.NewErrHttp(http.StatusUnprocessableEntity, validationError.Error())
189189
}
190190

191191
return nil

0 commit comments

Comments
 (0)