Is it necessary to drain a http client to fully read the http response body?
Opinion on the Go forums seems divided https://forum.golangbridge.org/t/do-i-need-to-read-the-body-before-close-it/5594 But a simple benchmark https://play.golang.org/p/5JDWYbRe0lD suggests that leaving unread data in the response body will prevent the connection being reused, and much slower performance. The documentation https://pkg.go.dev/net/http states: The client must close the response body when finished with it: But it is silent on the question of whether the client should consume the entire body. It would be good if the standard library documentation was a bit more explicit here. -- 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/2a29b5dc-e785-420f-bf58-72fb47470ba4n%40googlegroups.com.