Skip to content

Commit

Permalink
Close response body (#2213)
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 authored Sep 9, 2024
1 parent bcc659c commit 4983738
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/communitymodules/cluster/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ package cluster
import (
"context"
"fmt"
"net/http"
"slices"
"strings"
"time"

"github.com/avast/retry-go"
"github.com/kyma-project/cli.v3/internal/clierror"
"github.com/kyma-project/cli.v3/internal/communitymodules"
"github.com/kyma-project/cli.v3/internal/kube/resources"
"github.com/kyma-project/cli.v3/internal/kube/rootlessdynamic"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"net/http"
"slices"
"strings"
"time"
)

type ModuleInfo struct {
Expand Down Expand Up @@ -123,6 +124,7 @@ func downloadUnstructuredList(url string) ([]unstructured.Unstructured, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()

if resp.StatusCode != 200 {
return nil, fmt.Errorf("unexpected status code '%d'", resp.StatusCode)
Expand Down

0 comments on commit 4983738

Please sign in to comment.