NewRequest方式

func queryWf(context *gin.Context) (*wrapper.Response,*wrapper.Error){
	argoToken :="Bearer xxx"
	argoUrl :=fmt.Sprintf("https://192.168.110.110:1234/api/v1/workflows/dmcca-cicd/%s?tab=workflow",context.Param("name"))
	tr := &http.Transport{
		TLSClientConfig:    &tls.Config{InsecureSkipVerify: true}, //忽略证书校验
	}
	var client *http.Client = &http.Client{Transport: tr}
	req, _ := http.NewRequest("GET", argoUrl, nil)
	req.Header.Add("authorization", argoToken)
	resp, err := client.Do(req)
	if err != nil {
		log.Panic(err)
	}
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
	return wrapper.OK(string(body)),nil
}

Get方式

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://localhost:8081")
    if err != nil {
        fmt.Println("error:", err)
        return
    }
    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}