Radar · Go · Archive · Week 29 · Jul 13 – 19, 2026
net/http: drop support for Transport.CancelRequest
Worth knowingstdlib
- What changed
- The deprecated
Transport.CancelRequestfunction is removed. - Production impact
- The source does not say.
- Try it
- Build a small HTTP client and verify that
Transport.CancelRequestis no longer available. - Source
- github.com/golang/go/issues/79040
Understand it, then run it
The Transport.CancelRequest function was a way to stop an HTTP request that was already in progress. It was marked as deprecated in Go 1.6 and has been unused for many years. In the upcoming Go 1.28 release the function is removed entirely. If you see code that calls Transport.CancelRequest, it will no longer compile. The modern way to cancel a request is to use a context with NewRequestWithContext, which is the only supported cancellation mechanism.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed