mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
add CancelRequest to discovery round-tripper
This commit is contained in:
parent
d4d0276234
commit
07eae3a172
@ -20,6 +20,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
"github.com/gregjones/httpcache"
|
"github.com/gregjones/httpcache"
|
||||||
"github.com/gregjones/httpcache/diskcache"
|
"github.com/gregjones/httpcache/diskcache"
|
||||||
"github.com/peterbourgon/diskv"
|
"github.com/peterbourgon/diskv"
|
||||||
@ -47,4 +48,15 @@ func (rt *cacheRoundTripper) RoundTrip(req *http.Request) (*http.Response, error
|
|||||||
return rt.rt.RoundTrip(req)
|
return rt.rt.RoundTrip(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *cacheRoundTripper) CancelRequest(req *http.Request) {
|
||||||
|
type canceler interface {
|
||||||
|
CancelRequest(*http.Request)
|
||||||
|
}
|
||||||
|
if cr, ok := rt.rt.Transport.(canceler); ok {
|
||||||
|
cr.CancelRequest(req)
|
||||||
|
} else {
|
||||||
|
glog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }
|
func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }
|
||||||
|
Loading…
Reference in New Issue
Block a user