From 69a1fe37077fec052e7e4c25c65ac17b4000f014 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Sat, 20 Jun 2026 18:28:35 +0200 Subject: [PATCH] Handle GraphQL body close errors --- pkg/graphql.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/graphql.go b/pkg/graphql.go index 8ba37d3..e69cb94 100644 --- a/pkg/graphql.go +++ b/pkg/graphql.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "mal/pkg/errlog" "net/http" ) @@ -51,7 +52,9 @@ func Post[T any](ctx context.Context, httpClient *http.Client, url string, query if err != nil { return zero, fmt.Errorf("graphql: execute request: %w", err) } - defer func() { _ = resp.Body.Close() }() + defer func() { + errlog.Log("failed to close graphql response body", resp.Body.Close()) + }() bodyMax := opts.BodyMax if bodyMax <= 0 {