aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2023-08-24 10:58:51 -0700
committerGopher Robot <gobot@golang.org>2023-08-25 17:18:36 +0000
commit1a01cb22f9ab07d55ee61c95a34e1e18e49596c0 (patch)
treebc96a1e495a3de955866bf29d59bf68dcd615712 /src/net/http/request.go
parent92bbecc518533867a9bb381e261196111db2dd80 (diff)
downloadgo-1a01cb22f9ab07d55ee61c95a34e1e18e49596c0.tar.xz
net/http: document when request bodies are closed in more places
It isn't obvious that request bodies can be closed asynchronously, and it's easy to overlook the documentation of this fact in RoundTripper, which is a fairly low-level interface. Change-Id: I3b825c505418af7e1d3f6ed58f3704e55cf16901 Reviewed-on: https://go-review.googlesource.com/c/go/+/523036 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/net/http/request.go')
-rw-r--r--src/net/http/request.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net/http/request.go b/src/net/http/request.go
index 0fb73c12b5..12039c9ae2 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -845,8 +845,9 @@ func NewRequest(method, url string, body io.Reader) (*Request, error) {
// optional body.
//
// If the provided body is also an io.Closer, the returned
-// Request.Body is set to body and will be closed by the Client
-// methods Do, Post, and PostForm, and Transport.RoundTrip.
+// Request.Body is set to body and will be closed (possibly
+// asynchronously) by the Client methods Do, Post, and PostForm,
+// and Transport.RoundTrip.
//
// NewRequestWithContext returns a Request suitable for use with
// Client.Do or Transport.RoundTrip. To create a request for use with