Created
February 18, 2016 12:24
-
-
Save slav123/ce198745ec63b4050d99 to your computer and use it in GitHub Desktop.
make http.Get without checking SSL
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 ( | |
| "fmt" | |
| "net/http" | |
| "io/ioutil" | |
| "log" | |
| "crypto/tls" | |
| ) | |
| func main() { | |
| makeHook("https://id=11078") | |
| } | |
| // run hook | |
| func makeHook(hook string) { | |
| cfg := &tls.Config{InsecureSkipVerify: true} | |
| http.DefaultClient.Transport = &http.Transport{ | |
| TLSClientConfig: cfg, | |
| } | |
| resp, err := http.Get(hook) | |
| if err != nil { | |
| fmt.Println(err) | |
| log.Print("Failed to make hook "+hook) | |
| } else { | |
| defer resp.Body.Close() | |
| } | |
| body, err := ioutil.ReadAll(resp.Body) | |
| log.Print("Result "+string(body)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment