func NewClient(options ...Option) *Client {
	opts := newOptions()
	for _, option := range options {
		option(opts)
	}

	client := opts.httpClient
	transport := NewHTTPTLSTransport(TransportConfig{
		DisableKeepAlives:   opts.disableKeepAlives,
		TLSHandshakeTimeout: opts.tlsHandshakeTimeout,
		Middlewares:         opts.middlewares,
	})
	switch {
	case len(opts.caCertificates) > 0:
		transport = transportWithCerts(transport, opts.caCertificates, opts.skipHostnameVerification)
	case opts.skipHostnameVerification:
		transport = transportWithSkipVerify(transport, opts.skipHostnameVerification)
	}

	if opts.requestRecorder != nil {
		client.Transport = roundTripRecorder{
			requestRecorder:     opts.requestRecorder,
			wrappedRoundTripper: transport,
		}
	} else {
		client.Transport = transport
	}

	// Ensure we add the retry middleware after request recorder if there is
	// one, to ensure that we get all the logging at the right level.
	if opts.retryPolicy != nil {
		client.Transport = makeRetryMiddleware(
			client.Transport,
			*opts.retryPolicy,
			clock.WallClock,
			opts.logger,
		)
	}

	if opts.cookieJar != nil {
		client.Jar = opts.cookieJar
	}
	return &Client{
		HTTPClient: client,
		logger:     opts.logger,
	}
}
// NewClient returns a new juju http client defined
// by the given config.
NewClient returns a new juju http client defined
by the given config.
// NewClient returns a new juju http client defined // by the given config .
func NewClient(options ...Option) *Client {
	opts := newOptions()
	for _, option := range options {
		option(opts)
	}
	client := opts.httpClient
	transport := NewHTTPTLSTransport(TransportConfig{
		DisableKeepAlives:   opts.disableKeepAlives,
		TLSHandshakeTimeout: opts.tlsHandshakeTimeout,
		Middlewares:         opts.middlewares,
	})
	switch {
	case len(opts.caCertificates) > 0:
		transport = transportWithCerts(transport, opts.caCertificates, opts.skipHostnameVerification)
	case opts.skipHostnameVerification:
		transport = transportWithSkipVerify(transport, opts.skipHostnameVerification)
	}
	if opts.requestRecorder != nil {
		client.Transport = roundTripRecorder{
			requestRecorder:     opts.requestRecorder,
			wrappedRoundTripper: transport,
		}
	} else {
		client.Transport = transport
	}
	if opts.retryPolicy != nil {
		client.Transport = makeRetryMiddleware(
			client.Transport,
			*opts.retryPolicy,
			clock.WallClock,
			opts.logger,
		)
	}
	if opts.cookieJar != nil {
		client.Jar = opts.cookieJar
	}
	return &Client{
		HTTPClient: client,
		logger:     opts.logger,
	}
}
func NewClient ( options ... Option ) * Client { opts := newOptions ( ) for _ , option := range options { option ( opts ) } client := opts . httpClient transport := NewHTTPTLSTransport ( TransportConfig { DisableKeepAlives : opts . disableKeepAlives , TLSHandshakeTimeout : opts . tlsHandshakeTimeout , Middlewares : opts . middlewares , } ) switch { case len ( opts . caCertificates ) > 0 : transport = transportWithCerts ( transport , opts . caCertificates , opts . skipHostnameVerification ) case opts . skipHostnameVerification : transport = transportWithSkipVerify ( transport , opts . skipHostnameVerification ) } if opts . requestRecorder != nil { client . Transport = roundTripRecorder { requestRecorder : opts . requestRecorder , wrappedRoundTripper : transport , } } else { client . Transport = transport } if opts . retryPolicy != nil { client . Transport = makeRetryMiddleware ( client . Transport , * opts . retryPolicy , clock . WallClock , opts . logger , ) } if opts . cookieJar != nil { client . Jar = opts . cookieJar } return & Client { HTTPClient : client , logger : opts . logger , } }
NewClient returns a new juju http client defined
by the given config.
NewClient returns a new juju http client defined by the given config .
// Ensure we add the retry middleware after request recorder if there is // one, to ensure that we get all the logging at the right level.