opentofu/internal/httpclient/client.go
2023-08-27 14:46:17 +03:00

23 lines
547 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package httpclient
import (
"net/http"
cleanhttp "github.com/hashicorp/go-cleanhttp"
"github.com/placeholderplaceholderplaceholder/opentf/version"
)
// New returns the DefaultPooledClient from the cleanhttp
// package that will also send a Terraform User-Agent string.
func New() *http.Client {
cli := cleanhttp.DefaultPooledClient()
cli.Transport = &userAgentRoundTripper{
userAgent: TerraformUserAgent(version.Version),
inner: cli.Transport,
}
return cli
}