https client
This commit is contained in:
parent
277a226423
commit
3c4a25ad34
1
README
1
README
@ -54,7 +54,6 @@ gobyexample.com signups
|
|||||||
* listing files
|
* listing files
|
||||||
* tls server
|
* tls server
|
||||||
* tls client
|
* tls client
|
||||||
* https client
|
|
||||||
* buffered io
|
* buffered io
|
||||||
* tcp proxy
|
* tcp proxy
|
||||||
* http streaming server
|
* http streaming server
|
||||||
|
15
src/xx-https-client.go
Normal file
15
src/xx-https-client.go
Normal 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))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user