client := &http.Client{}
//生成要访问的url,token是api鉴权,每个api访问方式不同,根据api调用文档拼接URL
url := fmt.Sprintf("http://10.xxx.211.xxx:8091/jav/file_query?Type=md5&Value=%s×tamp=%s&token=%s", file.Value, timeStr, token)
//提交请求
request, err := http.NewRequest("GET", url, nil)
//异常捕捉
if err != nil {
panic(err)
}
//处理返回结果
response, _ := client.Do(request)
//关闭流
defer response.Body.Close()
//检出结果集
body, err := ioutil.ReadAll(response.Body)
if err != nil {
logs.Error("ioutil.ReadAll failed ,err:%v", err)
}