summaryrefslogtreecommitdiff
path: root/internal/platforms/mastodon
diff options
context:
space:
mode:
Diffstat (limited to 'internal/platforms/mastodon')
-rw-r--r--internal/platforms/mastodon/mastodon.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go
index ad4733b..3b68cde 100644
--- a/internal/platforms/mastodon/mastodon.go
+++ b/internal/platforms/mastodon/mastodon.go
@@ -52,7 +52,12 @@ func Post(ctx context.Context, args config.Args, sizeLimit int, en entry.Entry)
if err != nil {
return fmt.Errorf("request failed: %w", err)
}
- defer resp.Body.Close()
+ defer func() {
+ if err := resp.Body.Close(); err != nil {
+ // Log the error but don't fail the operation since we've already read the data
+ colour.Errorln("Error closing response body:", err)
+ }
+ }()
body, err := io.ReadAll(resp.Body)
if err != nil {
return err