On Sunday, April 17, 2022 at 11:52:17 PM UTC+10 toon....@gmail.com wrote:
> It is not clear to me from the documentation whether I can continue to use > an http.Client after a POST failed (due to the connection being closed ; > In my case the connection closes probably due to rate-limiting). > > The documentation of the http.Transport does mention that, if a network > error occurs, it will retry if the request is idempotent. Given I'm doing a > basicPOST that is not the case for me. > > But the http.Client will reestablish the connection on the next call to > Post(...) ? > I believe you will see that's the case. Perhaps worth experimenting with it? The reason is due to the underlying connection pooling behavior of the DefaultTransport: https://go.dev/src/net/http/transport.go#L42: " It establishes network connections as needed // and caches them for reuse by subsequent calls" > toon > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7e979f11-3f2d-43d5-a5c3-4081a1d06115n%40googlegroups.com.