github.com/stripe/stripe-go/v76@v76.25.0/stripe_go115.go (about) 1 //go:build go1.15 2 // +build go1.15 3 4 package stripe 5 6 import "net/http" 7 8 // This init block is only compiled on Go 1.15 and above 9 // (per https://golang.org/cmd/go/#hdr-Build_constraints). 10 // 11 // Go 1.15 fixes a long-standing bug https://github.com/golang/go/issues/32441 12 // that led to HTTP/2 being disabled by default in stripe-go 13 // in https://github.com/stripe/stripe-go/pull/903. 14 // 15 // This init is guaranteed to execute after all package-level var 16 // initializations have been completed, so the initialization of 17 // the `httpClient` package-level var will have completed before we 18 // run this init. 19 // 20 // Once stripe-go drops support for major Go versions below 1.15, this 21 // conditional build and init block should be removed, in favor of making 22 // this HTTP client the default. 23 func init() { 24 25 // Sets a default HTTP client that can utilize H/2 if the upstream supports it. 26 SetHTTPClient(&http.Client{ 27 Timeout: defaultHTTPTimeout, 28 }) 29 }