golang https 调用禁用ssl校验

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}
    var url = ""
    req, _ := http.NewRequest("GET", url, nil)
    resp, err :=client.Do(req)

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

golang https 调用禁用ssl校验

上一篇:jquery easyui easyui-combobox 与easyui-textbox 取值赋值操作


下一篇:Timing App的Serverless实践案例