Merge pull request #19892 from krousey/rtwrap
Add WrappedRoundTripper methods to round trippers
This commit is contained in:
@@ -97,6 +97,8 @@ func (rt *userAgentRoundTripper) CancelRequest(req *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *userAgentRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt }
|
||||||
|
|
||||||
type basicAuthRoundTripper struct {
|
type basicAuthRoundTripper struct {
|
||||||
username string
|
username string
|
||||||
password string
|
password string
|
||||||
@@ -126,6 +128,8 @@ func (rt *basicAuthRoundTripper) CancelRequest(req *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *basicAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt }
|
||||||
|
|
||||||
type bearerAuthRoundTripper struct {
|
type bearerAuthRoundTripper struct {
|
||||||
bearer string
|
bearer string
|
||||||
rt http.RoundTripper
|
rt http.RoundTripper
|
||||||
@@ -155,6 +159,8 @@ func (rt *bearerAuthRoundTripper) CancelRequest(req *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *bearerAuthRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt }
|
||||||
|
|
||||||
// cloneRequest returns a clone of the provided *http.Request.
|
// cloneRequest returns a clone of the provided *http.Request.
|
||||||
// The clone is a shallow copy of the struct and its Header map.
|
// The clone is a shallow copy of the struct and its Header map.
|
||||||
func cloneRequest(r *http.Request) *http.Request {
|
func cloneRequest(r *http.Request) *http.Request {
|
||||||
@@ -293,3 +299,7 @@ func (rt *debuggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, e
|
|||||||
|
|
||||||
return response, err
|
return response, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rt *debuggingRoundTripper) WrappedRoundTripper() http.RoundTripper {
|
||||||
|
return rt.delegatedRoundTripper
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user