Open jkryanchou opened 9 years ago
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 : )
You can set timeout with:
or
There is an example here: timeout.go