fix: Fixed error handling
All checks were successful
test / test (push) Successful in 44s
ci / goreleaser (push) Successful in 1m39s

This commit is contained in:
Patrick Sy 2025-11-17 15:43:08 +01:00
parent e38d7e84d5
commit 02856be541
Signed by: Patrick.Sy
GPG key ID: DDDC8EC51823195E

View file

@ -285,8 +285,7 @@ func isV2Response(bodyBytes []byte) (bool, error) {
func parseStreamingResponseV2[T Message](statusCode int, bodyBytes []byte) ([]T, error) {
var result []T
// Try parsing as a direct JSON array first (v2 API format)
if err := json.Unmarshal(bodyBytes, &result); err == nil {
if err := json.Unmarshal(bodyBytes, &result); err != nil {
return result, fmt.Errorf("failed to read response body: %w", err)
}