Skip to content

Instantly share code, notes, and snippets.

@slav123
Created February 18, 2016 12:24
Show Gist options
  • Select an option

  • Save slav123/ce198745ec63b4050d99 to your computer and use it in GitHub Desktop.

Select an option

Save slav123/ce198745ec63b4050d99 to your computer and use it in GitHub Desktop.
make http.Get without checking SSL
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