From: Damien Neil Date: Mon, 17 Jun 2024 21:54:22 +0000 (-0700) Subject: net/http: document that Request.Clone does not deep copy Body X-Git-Tag: go1.23rc2~2^2~48 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=29b1a6765f;p=gostls13.git net/http: document that Request.Clone does not deep copy Body Fixes #36095 Change-Id: I94ae014b0ee45b4aeb38cb247e42cfc13f663ded Reviewed-on: https://go-review.googlesource.com/c/go/+/593175 LUCI-TryBot-Result: Go LUCI Reviewed-by: Jonathan Amsterdam --- diff --git a/src/net/http/request.go b/src/net/http/request.go index 456615a79a..ad1b5a620b 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -377,6 +377,8 @@ func (r *Request) WithContext(ctx context.Context) *Request { // Clone returns a deep copy of r with its context changed to ctx. // The provided ctx must be non-nil. // +// Clone only makes a shallow copy of the Body field. +// // For an outgoing client request, the context controls the entire // lifetime of a request and its response: obtaining a connection, // sending the request, and reading the response headers and body.