swh:1:snp:272e298efac7922bc58929ef447c6a9add2959f8
Raw File
Tip revision: bc9ddf260115d2680191c46977ae72b837785472 authored by Gyu-Ho Lee on 01 February 2016, 19:59:45 UTC
*: bump to v2.2.5
Tip revision: bc9ddf2
cancelreq.go
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// borrowed from golang/net/context/ctxhttp/cancelreq.go

// +build go1.5

package client

import "net/http"

func requestCanceler(tr CancelableTransport, req *http.Request) func() {
	ch := make(chan struct{})
	req.Cancel = ch

	return func() {
		close(ch)
	}
}
back to top