diff --git a/src/net/http/client.go b/src/net/http/client.go index f57417ea10..617446b030 100644 --- a/src/net/http/client.go +++ b/src/net/http/client.go @@ -362,7 +362,7 @@ func setRequestCancel(req *Request, rt RoundTripper, deadline time.Time) (stopTi initialReqCancel := req.Cancel // the user's original Request.Cancel, if any var cancelCtx func() - if oldCtx := req.Context(); timeBeforeContextDeadline(deadline, oldCtx) { + if timeBeforeContextDeadline(deadline, oldCtx) { req.ctx, cancelCtx = context.WithDeadline(oldCtx, deadline) }