Last active
May 5, 2021 06:59
-
-
Save priesdelly/3a0f5c46d5a52de54eda6e245a66da98 to your computer and use it in GitHub Desktop.
Go http request to self signed domain (using go client) (credit: https://stackoverflow.com/questions/12122159/how-to-do-a-https-request-with-bad-certificate/12122718#12122718)
This file contains 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 ( | |
"fmt" | |
"net/http" | |
"crypto/tls" | |
) | |
func main() { | |
tr := &http.Transport{ | |
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, | |
} | |
client := &http.Client{Transport: tr} | |
_, err := client.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