In my Go App, I make a call to Hostname+"/translate/12345
Thing is depending the environment, in local Hostname
will be on http, and in production, it will be on https
When I test the production route on https with postman, there is no problem, route works fine.
But when I run it from WS, I get:
Get https://<mydomain.com>/translate/2327496366232: x509: certificate signed by unknown authority"
Here is my code:
var terID string
client := http.Client{}
req, err := http.NewRequest("GET", Hostname+"/translate/"+terID, nil)
if err != nil {
return "", err
}
req.SetBasicAuth(Username, Password)
res, err := client.Do(req)
if err != nil {
return "", err
}
What can I do to fix that ?
According to https://github.com/andygrunwald/go-jira/issues/52 , please try
import ("net/http"; "crypto/tls")
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify : true},
}
client := &http.Client{Transport: tr}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.