Created
July 21, 2016 23:47
-
-
Save glasser/d3af436a877f939f243b351fa1852539 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"io/ioutil" | |
"log" | |
"net/http" | |
cleanhttp "github.com/hashicorp/go-cleanhttp" | |
) | |
func main() { | |
t := cleanhttp.DefaultTransport() | |
certs, err := ioutil.ReadFile("acme-staging.pem") | |
if err != nil { | |
log.Fatal(err) | |
} | |
t.TLSClientConfig = &tls.Config{RootCAs: x509.NewCertPool()} | |
t.TLSClientConfig.RootCAs.AppendCertsFromPEM(certs) | |
c := &http.Client{Transport: t} | |
resp, err := c.Get("https://galaxy.test-20160721224638.meet-eeyore.com/") | |
log.Print(err) | |
log.Print(resp) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var fs = require('fs'); | |
https.get({ | |
hostname: 'galaxy.test-20160721224638.meet-eeyore.com', | |
path: '/', | |
ca: fs.readFileSync('acme-staging.pem') | |
}, function (res) { | |
console.log("got response", res.statusCode); | |
}).on('error', function (e) { | |
console.log("got error", e.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. Did you notice this in the documentation?