terraform/internal/httpclient/client.go
2023-08-10 23:43:27 +01:00

21 lines
467 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package httpclient
import (
"net/http"
cleanhttp "github.com/hashicorp/go-cleanhttp"
)
// 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: UserAgentString(),
inner: cli.Transport,
}
return cli
}