Skip to content

Commit

Permalink
Rename language fields in Stripe's user agent to start with lang
Browse files Browse the repository at this point in the history
I noticed this as I was looking at a dashboard that @ob-stripe produced
today. Other languages send language and language version as `lang` and
`lang_version` while we were using the fully expanded `language_*` here.
I'm changing it here for consistency with other libraries, but I'm also
going to patch the server because there are so many Go libraries out
there that could potentially be reporting if we supported both styles.
  • Loading branch information
brandur committed Nov 2, 2017
1 parent a104b8c commit 47840b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ type Backends struct {
type stripeClientUserAgent struct {
Application *AppInfo `json:"application"`
BindingsVersion string `json:"bindings_version"`
Language string `json:"language"`
LanguageVersion string `json:"language_version"`
Language string `json:"lang"`
LanguageVersion string `json:"lang_version"`
Publisher string `json:"publisher"`
Uname string `json:"uname"`
}
Expand Down
4 changes: 2 additions & 2 deletions stripe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ func TestStripeClientUserAgent(t *testing.T) {

assert.Empty(t, userAgent["application"])
assert.Equal(t, "go", userAgent["language"])
assert.Equal(t, runtime.Version(), userAgent["language_version"])
assert.Equal(t, runtime.Version(), userAgent["lang"])

// Anywhere these tests are running can reasonable be expected to have a
// `uname` to run, so do this basic check.
assert.NotEqual(t, stripe.UnknownPlatform, userAgent["language_version"])
assert.NotEqual(t, stripe.UnknownPlatform, userAgent["lang"])
}

func TestStripeClientUserAgentWithAppInfo(t *testing.T) {
Expand Down

0 comments on commit 47840b0

Please sign in to comment.