Browse code

Make client underlying HTTP client accessible

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>

Mathieu Champlon authored on 2018/05/15 22:12:30
Showing 2 changed files
... ...
@@ -356,6 +356,11 @@ func (cli *Client) DaemonHost() string {
356 356
 	return cli.host
357 357
 }
358 358
 
359
+// HTTPClient returns a copy of the HTTP client bound to the server
360
+func (cli *Client) HTTPClient() *http.Client {
361
+	return &*cli.client
362
+}
363
+
359 364
 // ParseHostURL parses a url string, validates the string is a host url, and
360 365
 // returns the parsed URL
361 366
 func ParseHostURL(host string) (*url.URL, error) {
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"context"
5 5
 	"io"
6 6
 	"net"
7
+	"net/http"
7 8
 	"time"
8 9
 
9 10
 	"github.com/docker/docker/api/types"
... ...
@@ -33,6 +34,7 @@ type CommonAPIClient interface {
33 33
 	VolumeAPIClient
34 34
 	ClientVersion() string
35 35
 	DaemonHost() string
36
+	HTTPClient() *http.Client
36 37
 	ServerVersion(ctx context.Context) (types.Version, error)
37 38
 	NegotiateAPIVersion(ctx context.Context)
38 39
 	NegotiateAPIVersionPing(types.Ping)