fix: Fixed error handling
This commit is contained in:
parent
e38d7e84d5
commit
02856be541
1 changed files with 1 additions and 2 deletions
|
|
@ -285,8 +285,7 @@ func isV2Response(bodyBytes []byte) (bool, error) {
|
||||||
|
|
||||||
func parseStreamingResponseV2[T Message](statusCode int, bodyBytes []byte) ([]T, error) {
|
func parseStreamingResponseV2[T Message](statusCode int, bodyBytes []byte) ([]T, error) {
|
||||||
var result []T
|
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)
|
return result, fmt.Errorf("failed to read response body: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue