go https client

go https client get

go 语言如何使用https client, 其实还是很简单的,首先要 import “crypto/tls”
然后使用TLSClientConfig

show me the code

package main

import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}
	resp, err := client.Get("https://blog.csdn.net/qianbo042311/article/details/118654609")

	if err != nil {
		fmt.Println("error:", err)
		return
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

你可能感兴趣的:(go,go,httpsclient)