Merge pull request #1310 from hashicorp/fix-http-defaultclient

Don't use http.DefaultClient
This commit is contained in:
Jeff Mitchell 2015-10-15 17:49:55 -04:00
commit 6ee4ff5835
3 changed files with 7 additions and 5 deletions

View File

@ -119,7 +119,7 @@ func DefaultConfig() *Config {
config := &Config{ config := &Config{
Address: "127.0.0.1:8500", Address: "127.0.0.1:8500",
Scheme: "http", Scheme: "http",
HttpClient: http.DefaultClient, HttpClient: &http.Client{},
} }
if addr := os.Getenv("CONSUL_HTTP_ADDR"); addr != "" { if addr := os.Getenv("CONSUL_HTTP_ADDR"); addr != "" {

View File

@ -3,8 +3,6 @@ package agent
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/hashicorp/consul/consul/structs"
"github.com/hashicorp/consul/testutil"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
@ -13,6 +11,9 @@ import (
"path/filepath" "path/filepath"
"reflect" "reflect"
"testing" "testing"
"github.com/hashicorp/consul/consul/structs"
"github.com/hashicorp/consul/testutil"
) )
func TestUiIndex(t *testing.T) { func TestUiIndex(t *testing.T) {
@ -36,7 +37,8 @@ func TestUiIndex(t *testing.T) {
req.URL.Host = srv.listener.Addr().String() req.URL.Host = srv.listener.Addr().String()
// Make the request // Make the request
resp, err := http.DefaultClient.Do(req) client := &http.Client{}
resp, err := client.Do(req)
if err != nil { if err != nil {
t.Fatalf("err: %v", err) t.Fatalf("err: %v", err)
} }

View File

@ -200,7 +200,7 @@ func NewTestServerConfig(t *testing.T, cb ServerConfigCallback) *TestServer {
} }
} else { } else {
httpAddr = fmt.Sprintf("127.0.0.1:%d", consulConfig.Ports.HTTP) httpAddr = fmt.Sprintf("127.0.0.1:%d", consulConfig.Ports.HTTP)
client = http.DefaultClient client = &http.Client{}
} }
server := &TestServer{ server := &TestServer{