*: Use http.Request.WithContext instead of Cancel

This commit is contained in:
sharat
2017-02-02 18:49:02 +05:30
parent 42e7d4d09d
commit 9def4cb9fe
3 changed files with 22 additions and 49 deletions

View File

@@ -13,15 +13,6 @@ import (
"net/http"
)
func RequestCanceler(req *http.Request) func() {
ch := make(chan struct{})
req.Cancel = ch
return func() {
close(ch)
}
}
// GracefulClose drains http.Response.Body until it hits EOF
// and closes it. This prevents TCP/TLS connections from closing,
// therefore available for reuse.