mirror of
https://github.com/FlipsideCrypto/databricks-sdk-golang.git
synced 2026-02-06 10:57:34 +00:00
Use global httpclient
This commit is contained in:
parent
496587c3bf
commit
1ee73b1324
@ -10,6 +10,7 @@ type DBClient struct {
|
||||
// Init initializes the client
|
||||
func (c *DBClient) Init(option databricks.DBClientOption) DBClient {
|
||||
c.Option = option
|
||||
option.Init()
|
||||
return *c
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ type DBClient struct {
|
||||
// Init initializes the client
|
||||
func (c *DBClient) Init(option databricks.DBClientOption) DBClient {
|
||||
c.Option = option
|
||||
option.Init()
|
||||
return *c
|
||||
}
|
||||
|
||||
|
||||
@ -18,13 +18,15 @@ type DBClientOption struct {
|
||||
DefaultHeaders map[string]string
|
||||
InsecureSkipVerify bool
|
||||
TimeoutSeconds int
|
||||
client http.Client
|
||||
}
|
||||
|
||||
func (o *DBClientOption) getHTTPClient() http.Client {
|
||||
// Init initializes the client
|
||||
func (o *DBClientOption) Init() {
|
||||
if o.TimeoutSeconds == 0 {
|
||||
o.TimeoutSeconds = 10
|
||||
}
|
||||
client := http.Client{
|
||||
o.client = http.Client{
|
||||
Timeout: time.Duration(time.Duration(o.TimeoutSeconds) * time.Second),
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
@ -32,7 +34,10 @@ func (o *DBClientOption) getHTTPClient() http.Client {
|
||||
},
|
||||
},
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
func (o *DBClientOption) getHTTPClient() http.Client {
|
||||
return o.client
|
||||
}
|
||||
|
||||
func (o *DBClientOption) getAuthHeader() map[string]string {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user