request
request copied to clipboard
Cannot set timeout for request or any other method
You can set timeout with:
c := new(http.Client)
timeout := time.Duration(1 * time.Second)
c.Timeout = timeout
req := request.NewRequest(c)
req.Get(url)
or
timeout := time.Duration(1 * time.Second)
c := &http.Client{
Timeout: timeout
}
req := request.NewRequest(c)
req.Get(url)
There is an example here: timeout.go
$ go run timeout.go
default timeout
21.030151555
set timeout = 1.000000 seconds
1.0007582
Great, I'm very appreciated for your answer :+1:
I think it's better to be added into to the godoc : )