mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use net/http instead of x/ctxhttp
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
4c3926a997
commit
3e5b9cb466
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,6 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/net/context/ctxhttp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// serverResponse is a wrapper for http API responses.
|
// serverResponse is a wrapper for http API responses.
|
||||||
|
@ -129,7 +128,8 @@ func (cli *Client) sendRequest(ctx context.Context, method, path string, query u
|
||||||
func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResponse, error) {
|
func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResponse, error) {
|
||||||
serverResp := serverResponse{statusCode: -1, reqURL: req.URL}
|
serverResp := serverResponse{statusCode: -1, reqURL: req.URL}
|
||||||
|
|
||||||
resp, err := ctxhttp.Do(ctx, cli.client, req)
|
req = req.WithContext(ctx)
|
||||||
|
resp, err := cli.client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if cli.scheme != "https" && strings.Contains(err.Error(), "malformed HTTP response") {
|
if cli.scheme != "https" && strings.Contains(err.Error(), "malformed HTTP response") {
|
||||||
return serverResp, fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err)
|
return serverResp, fmt.Errorf("%v.\n* Are you trying to connect to a TLS-enabled daemon without TLS?", err)
|
||||||
|
|
Loading…
Reference in a new issue