proposal: net/http: allow setting timeouts individually in Client #23100
Comments
@bradfitz I think this can be closed, because all of the timeouts mentioned are supported in |
My point is I guess more that it could be made much much easier to use than it currently is; needing to know to have to setup your custom Either way, I believe it'd be great to have this in |
This seems very specific, and it's already possible. It's unclear we need to thread it through in a second way, from Client. More generally we need a nicer Client, and instead of adding one thing at a time there should be a redesign at some point. @bradfitz is going to make a tracking bug for the things we'd want to fix in a new Client. |
I filed #23707 as a meta bug for tracking http.Client improvements, which could/should include more timeout control. |
Cool, I think I'm happy with it being part of the http.Client improvements in #23707 . |
Thanks. I'll close this one for now then. |
What version of Go are you using (
go version
)?go1.9 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
It's not a bug; more a feature request. When calling a HTTP endpoint using http.Client; it'd be great if it was possible to individually configure the
connection timeout
from theresponse timeout
and a generictimeout
that would count for both. Reason I'm asking for this is to be able to fail fast when a endpoint just isn't there, vs wait for potentially longer when there is a endpoint and it's slow to respond. I've found some implementation of this, but it is much more "work" than it really should be.https://stackoverflow.com/questions/16895294/how-to-set-timeout-for-http-get-requests-in-golang
Cloudflare's blog is pretty good, and much more concise, however, still more than I would have expected : https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: