Skip to content

Commit e5bdd84

Browse files
committed
add cli httpclient
1 parent a383457 commit e5bdd84

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

httpclient/httpclient.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package httpclient
2+
3+
import (
4+
"net/http"
5+
)
6+
7+
// New returns a default http client for use in the cli API calls
8+
func New() (*http.Client, error) {
9+
config, err := DefaultConfig()
10+
11+
if err != nil {
12+
return nil, err
13+
}
14+
15+
return NewWithConfig(config), nil
16+
}
17+
18+
// NewWithConfig creates a http client for use in the cli API calls with a given configuration
19+
func NewWithConfig(config *Config) *http.Client {
20+
transport := newHTTPClientTransport(config)
21+
22+
return &http.Client{
23+
Transport: transport,
24+
}
25+
}

0 commit comments

Comments
 (0)