Skip to content

Commit c84c44c

Browse files
Remove else in favour of continue
1 parent cc19b64 commit c84c44c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

cmd/mcpcurl/main.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -434,18 +434,19 @@ func printResponse(response string, prettyPrint bool) error {
434434
return fmt.Errorf("failed to pretty print text content: %w", err)
435435
}
436436
fmt.Println(string(prettyText))
437-
} else {
438-
var textContentList []interface{}
439-
if err := json.Unmarshal([]byte(content.Text), &textContentList); err != nil {
440-
return fmt.Errorf("failed to parse text content as a list: %w", err)
441-
}
442-
// Pretty print the array content
443-
prettyText, err := json.MarshalIndent(textContentList, "", " ")
444-
if err != nil {
445-
return fmt.Errorf("failed to pretty print array content: %w", err)
446-
}
447-
fmt.Println(string(prettyText))
437+
continue
438+
}
439+
440+
// Fallback parsing as JSONL
441+
var textContentList []map[string]interface{}
442+
if err := json.Unmarshal([]byte(content.Text), &textContentList); err != nil {
443+
return fmt.Errorf("failed to parse text content as a list: %w", err)
444+
}
445+
prettyText, err := json.MarshalIndent(textContentList, "", " ")
446+
if err != nil {
447+
return fmt.Errorf("failed to pretty print array content: %w", err)
448448
}
449+
fmt.Println(string(prettyText))
449450
}
450451
}
451452

0 commit comments

Comments
 (0)