1
0
mirror of https://github.com/golang/go synced 2024-11-26 11:38:01 -07:00

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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Damien Neil 2024-06-17 14:54:22 -07:00
parent cf54a3d114
commit 29b1a6765f

View File

@ -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. // Clone returns a deep copy of r with its context changed to ctx.
// The provided ctx must be non-nil. // 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 // For an outgoing client request, the context controls the entire
// lifetime of a request and its response: obtaining a connection, // lifetime of a request and its response: obtaining a connection,
// sending the request, and reading the response headers and body. // sending the request, and reading the response headers and body.