Exposing http.Client for configurable timeouts

This commit is contained in:
Kris
2015-11-10 13:40:51 -08:00
parent 447fe209ab
commit 4a4d195419
6 changed files with 35 additions and 38 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package unversioned
import (
"net/http"
"net/url"
"strings"
@@ -43,7 +44,7 @@ type RESTClient struct {
// Set specific behavior of the client. If not set http.DefaultClient will be
// used.
Client HTTPClient
Client *http.Client
// TODO extract this into a wrapper interface via the RESTClient interface in kubectl.
Throttle util.RateLimiter
@@ -88,6 +89,9 @@ func (c *RESTClient) Verb(verb string) *Request {
if c.Throttle != nil {
c.Throttle.Accept()
}
if c.Client == nil {
return NewRequest(nil, verb, c.baseURL, c.apiVersion, c.Codec)
}
return NewRequest(c.Client, verb, c.baseURL, c.apiVersion, c.Codec)
}