1
0
mirror of https://github.com/rancher/norman.git synced 2025-08-31 23:02:01 +00:00

Make websocket dialer use same TLSClientConfig has http client

This commit is contained in:
Darren Shepherd
2018-06-19 11:18:04 -07:00
parent 875bcf4b2d
commit fbc49a97af
2 changed files with 9 additions and 2 deletions

View File

@@ -25,7 +25,6 @@ const (
var (
debug = false
dialer = &websocket.Dialer{}
)
type APIBaseClientInterface interface {
@@ -265,9 +264,15 @@ func NewAPIClient(opts *ClientOpts) (APIBaseClient, error) {
result.Ops = &APIOperations{
Opts: opts,
Client: client,
Dialer: &websocket.Dialer{},
Types: result.Types,
}
ht, ok := client.Transport.(*http.Transport)
if ok {
result.Ops.Dialer.TLSClientConfig = ht.TLSClientConfig
}
return result, nil
}
@@ -287,7 +292,7 @@ func (a *APIBaseClient) Websocket(url string, headers map[string][]string) (*web
httpHeaders.Add("Authorization", a.Opts.getAuthHeader())
}
return dialer.Dial(url, http.Header(httpHeaders))
return a.Ops.Dialer.Dial(url, http.Header(httpHeaders))
}
func (a *APIBaseClient) List(schemaType string, opts *types.ListOpts, respObject interface{}) error {