Skip to content

Commit

Permalink
Added possibility to set http transport (#21)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor Suvorov <[email protected]>
  • Loading branch information
suvorovis and Igor Suvorov committed Mar 23, 2023
1 parent a3f54dd commit 39c3e85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@ func NewClient(opts *Config) (*Client, error) {
// Jar: jar,
// Timeout: 0,
// }
transport := http.DefaultTransport
if opts.Transport != nil {
transport = opts.Transport
}

client.httpClient = &http.Client{
Transport: http.DefaultTransport,
Transport: transport,
}

serverURL := DefaultServerURL
Expand Down
2 changes: 2 additions & 0 deletions pkg/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package client

import (
"net/http"
"os"
)

Expand All @@ -38,6 +39,7 @@ type Config struct {
Password string
AccessToken string
UserAgent string
Transport http.RoundTripper
}

func (c *Config) ReadFromEnvironment() {
Expand Down

0 comments on commit 39c3e85

Please sign in to comment.