1
0
mirror of https://github.com/golang/go synced 2024-11-12 02:20:23 -07:00

net/http: make Transport.CancelRequest doc recommend Request.WithContext

The old deprecation docs were referencing another deprecated field.

Fixes #16752

Change-Id: I44a690048e00ddc790a80214ecb7f5bb0a5b7b34
Reviewed-on: https://go-review.googlesource.com/27510
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-08-22 18:59:20 +00:00
parent 4187e1f49f
commit 355d7fa8a8

View File

@ -494,8 +494,9 @@ func (t *Transport) CloseIdleConnections() {
// CancelRequest cancels an in-flight request by closing its connection.
// CancelRequest should only be called after RoundTrip has returned.
//
// Deprecated: Use Request.Cancel instead. CancelRequest cannot cancel
// HTTP/2 requests.
// Deprecated: Use Request.WithContext to create a request with a
// cancelable context instead. CancelRequest cannot cancel HTTP/2
// requests.
func (t *Transport) CancelRequest(req *Request) {
t.reqMu.Lock()
cancel := t.reqCanceler[req]