Skip to content

Commit 5a84124

Browse files
committed
Make client underlying HTTP client accessible
Signed-off-by: Mathieu Champlon <[email protected]>
1 parent 04864cb commit 5a84124

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

client/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ func (cli *Client) DaemonHost() string {
356356
return cli.host
357357
}
358358

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+
359364
// ParseHostURL parses a url string, validates the string is a host url, and
360365
// returns the parsed URL
361366
func ParseHostURL(host string) (*url.URL, error) {

client/interface.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"io"
66
"net"
7+
"net/http"
78
"time"
89

910
"github.com/docker/docker/api/types"
@@ -33,6 +34,7 @@ type CommonAPIClient interface {
3334
VolumeAPIClient
3435
ClientVersion() string
3536
DaemonHost() string
37+
HTTPClient() *http.Client
3638
ServerVersion(ctx context.Context) (types.Version, error)
3739
NegotiateAPIVersion(ctx context.Context)
3840
NegotiateAPIVersionPing(types.Ping)

0 commit comments

Comments
 (0)