refactor(misc): small code refactor

This commit is contained in:
yusing
2025-07-13 14:33:58 +08:00
parent a954ac8946
commit e3b53a548d
3 changed files with 66 additions and 71 deletions

View File

@@ -34,16 +34,15 @@ func (c *Config) Client() *Client {
func (c *Config) Init() gperr.Error {
var tr *http.Transport
if c.NoTLSVerify {
// user specified
tr = gphttp.NewTransportWithTLSConfig(&tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: true, //nolint:gosec
})
} else {
tr = gphttp.NewTransport()
}
if strings.HasSuffix(c.URL, "/") {
c.URL = c.URL[:len(c.URL)-1]
}
c.URL = strings.TrimSuffix(c.URL, "/")
if !strings.HasSuffix(c.URL, "/api2/json") {
c.URL += "/api2/json"
}