Replace usage of http.DefaultClient and http.DefaultTransport (#104135)

Remove usage of http.DefaultClient and http.DefaultTransport

Part of grafana/data-sources#484
This commit is contained in:
beejeebus
2025-05-09 13:26:39 -04:00
committed by GitHub
parent 8f4b2bbece
commit 8f79e4882f
18 changed files with 120 additions and 44 deletions
+3 -1
View File
@@ -13,6 +13,7 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/services/licensing"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/httpclient"
)
type ManifestInfo struct {
@@ -36,6 +37,7 @@ type EntryPointInfo struct {
var (
entryPointAssetsCacheMu sync.RWMutex // guard entryPointAssetsCache
entryPointAssetsCache *dtos.EntryPointAssets // TODO: get rid of global state
httpClient = httpclient.New()
)
func GetWebAssets(ctx context.Context, cfg *setting.Cfg, license licensing.Licensing) (*dtos.EntryPointAssets, error) {
@@ -88,7 +90,7 @@ func readWebAssetsFromCDN(ctx context.Context, baseURL string) (*dtos.EntryPoint
if err != nil {
return nil, err
}
response, err := http.DefaultClient.Do(req)
response, err := httpClient.Do(req)
if err != nil {
return nil, err
}