https client

This commit is contained in:
Mark McGranaghan 2012-09-19 06:15:12 -07:00
parent 277a226423
commit 3c4a25ad34
2 changed files with 15 additions and 1 deletions

1
README
View File

@ -54,7 +54,6 @@ gobyexample.com signups
* listing files
* tls server
* tls client
* https client
* buffered io
* tcp proxy
* http streaming server

15
src/xx-https-client.go Normal file
View File

@ -0,0 +1,15 @@
package main
import ("net/http"; "crypto/tls"; "io/ioutil"; "fmt")
func main() {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
resp, err := client.Get("https://127.0.0.1:5000/")
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Print(string(body))
}