From 9cdaa7b419fd060c9cbfab7641c21adb0505163d Mon Sep 17 00:00:00 2001 From: Ragnar Rova Date: Sun, 22 Feb 2015 00:56:50 +0100 Subject: [PATCH] Make it possible to supply your own http client --- dockerclient.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dockerclient.go b/dockerclient.go index 09f4d1e..0673a57 100644 --- a/dockerclient.go +++ b/dockerclient.go @@ -63,6 +63,10 @@ func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout tim return &DockerClient{u, httpClient, tlsConfig, 0}, nil } +func NewDockerClientFromHttpClient(u *url.URL, httpClient *http.Client, tlsConfig *tls.Config) (*DockerClient, error) { + return &DockerClient{u, httpClient, tlsConfig, 0}, nil +} + func (client *DockerClient) doRequest(method string, path string, body []byte, headers map[string]string) ([]byte, error) { b := bytes.NewBuffer(body) req, err := http.NewRequest(method, client.URL.String()+path, b)