Skip to content

Instantly share code, notes, and snippets.

@priesdelly
Last active May 5, 2021 06:59
Show Gist options
  • Save priesdelly/4ec46adcbcf5ab27c386c2a3a274fe56 to your computer and use it in GitHub Desktop.
Save priesdelly/4ec46adcbcf5ab27c386c2a3a274fe56 to your computer and use it in GitHub Desktop.
Go http request to self signed domain (using direct go http) (credit: https://stackoverflow.com/questions/12122159/how-to-do-a-https-request-with-bad-certificate/12122718#12122718)
package main
import (
"fmt"
"net/http"
"crypto/tls"
)
func main() {
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
_, err := http.Get("https://golang.org/")
if err != nil {
fmt.Println(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment