blob: 76d1f040198bc49eca16165a90b53a589daedebe [file] [log] [blame]
khenaidoo59ce9dd2019-11-11 13:05:32 -05001// Copyright 2015 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// borrowed from golang/net/context/ctxhttp/cancelreq.go
6
7package client
8
9import "net/http"
10
11func requestCanceler(tr CancelableTransport, req *http.Request) func() {
12 ch := make(chan struct{})
13 req.Cancel = ch
14
15 return func() {
16 close(ch)
17 }
18}