From ba717cfdb69652ec9d222a6abad6a83f171c7d84 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Sun, 7 Jan 2024 21:50:02 +0100 Subject: [PATCH] Attempt to unmarshal response --- main.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index c1e6915..01dbd4c 100644 --- a/main.go +++ b/main.go @@ -168,11 +168,14 @@ func main() { } githubactions.Infof("Response: %v", string(resBody)) - var ipfsAddResponse []AddResponse - json.Unmarshal(resBody, &ipfsAddResponse) - if err != nil { - githubactions.Fatalf(err.Error()) + d := json.NewDecoder(res.Body) + for { + var ipfsAddResponse []AddResponse + if err := d.Decode(&ipfsAddResponse); err == io.EOF { + break + } else if err != nil { + githubactions.Warningf("Failed to unmarshal response: %v", fmt.Errorf("%w", err)) + } + githubactions.Infof("Received response: %v", ipfsAddResponse) } - - githubactions.Infof("Response: %v", ipfsAddResponse) }