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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user