📌  相关文章
📜  golang 获取请求数据 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:45:01.232000             🧑  作者: Mango

代码示例1
package main

func fetchResponse(url string) string{
    resp, _ := http.Get(url)    
    defer resp.Body.Close()
    body, _ := ioutil.ReadAll(resp.Body)
    return string(body)
}

func main() {    
    resp := fetchResponse("http://someurl.com")
    fmt.Println(resp)
}