mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-05 00:51:02 +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
@@ -18,6 +18,7 @@ go_library(
|
||||
deps = [
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/golang.org/x/oauth2:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@@ -30,6 +30,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/oauth2"
|
||||
"k8s.io/apimachinery/pkg/util/net"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
@@ -189,6 +190,8 @@ type roundTripper struct {
|
||||
wrapped http.RoundTripper
|
||||
}
|
||||
|
||||
var _ net.RoundTripperWrapper = &roundTripper{}
|
||||
|
||||
func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
if len(req.Header.Get("Authorization")) != 0 {
|
||||
return r.wrapped.RoundTrip(req)
|
||||
@@ -212,6 +215,8 @@ func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return r.wrapped.RoundTrip(r2)
|
||||
}
|
||||
|
||||
func (t *roundTripper) WrappedRoundTripper() http.RoundTripper { return t.wrapped }
|
||||
|
||||
func (p *oidcAuthProvider) idToken() (string, error) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
Reference in New Issue
Block a user