mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-02 11:05:45 -05:00
25 lines
601 B
Go
25 lines
601 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package httpclient
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
cleanhttp "github.com/hashicorp/go-cleanhttp"
|
|
"github.com/opentofu/opentofu/version"
|
|
)
|
|
|
|
// New returns the DefaultPooledClient from the cleanhttp
|
|
// package that will also send a OpenTofu User-Agent string.
|
|
func New() *http.Client {
|
|
cli := cleanhttp.DefaultPooledClient()
|
|
cli.Transport = &userAgentRoundTripper{
|
|
userAgent: OpenTofuUserAgent(version.Version),
|
|
inner: cli.Transport,
|
|
}
|
|
return cli
|
|
}
|