mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-26 15:17:05 +00:00
client-go: Update RoundTrippers to be Unwrappable
Kubernetes-commit: fd5775c192fb4d47250a2d99f3e022acb1c7c0f0
This commit is contained in:
committed by
Kubernetes Publisher
parent
db8228460e
commit
fc47db2e7e
@@ -21,6 +21,7 @@ go_library(
|
||||
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
|
||||
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
@@ -113,6 +114,8 @@ type azureRoundTripper struct {
|
||||
roundTripper http.RoundTripper
|
||||
}
|
||||
|
||||
var _ net.RoundTripperWrapper = &azureRoundTripper{}
|
||||
|
||||
func (r *azureRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
if len(req.Header.Get(authHeader)) != 0 {
|
||||
return r.roundTripper.RoundTrip(req)
|
||||
@@ -137,6 +140,8 @@ func (r *azureRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
|
||||
return r.roundTripper.RoundTrip(req2)
|
||||
}
|
||||
|
||||
func (r *azureRoundTripper) WrappedRoundTripper() http.RoundTripper { return r.roundTripper }
|
||||
|
||||
type azureToken struct {
|
||||
token adal.Token
|
||||
clientID string
|
||||
|
Reference in New Issue
Block a user