diff --git a/http/contract/clientInterface.go b/http/contract/clientInterface.go index 37e7063..1662741 100644 --- a/http/contract/clientInterface.go +++ b/http/contract/clientInterface.go @@ -1,6 +1,7 @@ package contract import ( + "crypto/tls" "net/http" "time" ) @@ -10,7 +11,7 @@ type ClientConfig struct { Cert CertConfig ProxyURI string // 如果需要定制化tls, 设置该属性, 否则请使用Cert - // TlsConfig *tls.Config + TlsConfig *tls.Config } type CertConfig struct { @@ -22,6 +23,7 @@ func (c *ClientConfig) Default() { if c.Timeout == 0 { c.Timeout = time.Second * 30 } + c.TlsConfig = &tls.Config{InsecureSkipVerify: true} } type ClientInterface interface { diff --git a/http/drivers/http/client_test.go b/http/drivers/http/client_test.go new file mode 100644 index 0000000..7b7ce44 --- /dev/null +++ b/http/drivers/http/client_test.go @@ -0,0 +1,18 @@ +package http + +import ( + "github.com/ArtisanCloud/PowerLibs/v3/http/contract" + "testing" +) + +func Test_NewClient(t *testing.T) { + helper, err := NewHttpClient(&contract.ClientConfig{}) + if err != nil { + t.Error(err) + } + + if helper == nil { + t.Error(err) + } + +}