Is there a way to set a timeout limit for net/http's client.Get()?
Currently I have this much;
func disallowRedirect(req *http.Request, via []*http.Request) error {
return errors.New("Redirection is not allowed.")
}
func somefunction(url string, timeout float64, userAgent string)
client := &http.Client(
CheckRedirect: disallowRedirect,
)
req, err := http.NewRequest("GET", url, nil);
if err != nil {
return
}
req.Header.add("User-Agent", userAgent);
client.Do(req)
}