📅  最后修改于: 2022-03-11 14:45:02.668000             🧑  作者: Mango
import "net/http"
req, err := http.NewRequest("GET", "http://httpbin.org/user-agent", nil)
if err != nil {
log.Fatalln(err)
}
req.Header.Set("User-Agent", "Golang_Spider_Bot/3.0")
//afetr prepear the request we should submit to http client to perform it
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatalln(err)
}