Skip to content

Commit

Permalink
Use standard user-agent header (#1332)
Browse files Browse the repository at this point in the history
This PR does a few things to the User-Agent header:

1. It puts Terraform/(version) first, since that's the way the RFC
expects it

2. It removes the goos and goarch data, although I could be convinced to
put it back in, I don't see what value it's providing

3. Moves directly to consuming the version package (which is the comment
above the function previously being called)
  • Loading branch information
sethvargo authored and danawillow committed Apr 13, 2018
1 parent f643b0d commit 0cdcd66
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (
"fmt"
"log"
"net/http"
"runtime"
"strings"

"github.com/hashicorp/terraform/helper/logging"
"github.com/hashicorp/terraform/helper/pathorcontents"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform/version"

"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
Expand Down Expand Up @@ -141,9 +140,9 @@ func (c *Config) loadAndValidate() error {

client.Transport = logging.NewTransport("Google", client.Transport)

versionString := terraform.VersionString()
userAgent := fmt.Sprintf(
"(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, versionString)
projectURL := "https://www.terraform.io"
userAgent := fmt.Sprintf("Terraform/%s (+%s)",
version.String(), projectURL)

c.client = client
c.userAgent = userAgent
Expand Down

0 comments on commit 0cdcd66

Please sign in to comment.