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 c096661
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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
6 changes: 3 additions & 3 deletions stripe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ 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, "go", userAgent["lang"])
assert.Equal(t, runtime.Version(), userAgent["lang_version"])

// 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_version"])
}

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

0 comments on commit c096661

Please sign in to comment.