You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
668 B
34 lines
668 B
package client
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net/http"
|
|
"net/url"
|
|
"time"
|
|
|
|
"repos.digitalenergy.online/BASIS/decort-golang-sdk/config"
|
|
)
|
|
|
|
// NewLegacyHttpClient creates legacy HTTP Client
|
|
func NewLegacyHttpClient(cfg config.LegacyConfig) *http.Client {
|
|
transCfg := &http.Transport{
|
|
TLSClientConfig: &tls.Config{
|
|
//nolint:gosec
|
|
InsecureSkipVerify: cfg.SSLSkipVerify,
|
|
},
|
|
}
|
|
|
|
return &http.Client{
|
|
Transport: &transportLegacy{
|
|
base: transCfg,
|
|
username: url.QueryEscape(cfg.Username),
|
|
password: url.QueryEscape(cfg.Password),
|
|
retries: cfg.Retries,
|
|
token: cfg.Token,
|
|
decortURL: cfg.DecortURL,
|
|
},
|
|
|
|
Timeout: 5 * time.Minute,
|
|
}
|
|
}
|