编程语言
首页 > 编程语言> > 小程序报错x509: certificate signed by unknown authority

小程序报错x509: certificate signed by unknown authority

作者:互联网

设置tls跳过证书

timeout = time.Duration(10 * time.Second) //超时时间50ms
client  = &http.Client{
    Timeout: timeout,
    Transport: &http.Transport{
        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
    }
}

这样,使用client就不会再报该错误了。但此方法是跳过了检测,在某些场景并不适用,就只能使用其他方式了。

标签:tls,http,certificate,x509,client,报错,timeout,time,Transport
来源: https://www.cnblogs.com/tsxylhs/p/13043030.html