$ go test --cover
2015/12/03 20:04:53 http: TLS handshake error from 127.0.0.1:61877: remote error: bad certificate
--- FAIL: TestClientHead_h2 (0.05s)
client_test.go:103: Head https://127.0.0.1:61876: x509: certificate signed by unknown authority
FAIL
coverage: 74.0% of statements
exit status 1
FAIL net/http 22.587s
Last active
April 26, 2016 08:42
-
-
Save odeke-em/c69a9a9c875a8dd65d78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/net/http/client_test.go b/src/net/http/client_test.go | |
index e59ab2c..ba0beff 100644 | |
--- a/src/net/http/client_test.go | |
+++ b/src/net/http/client_test.go | |
@@ -65,12 +65,15 @@ func (w chanWriter) Write(p []byte) (n int, err error) { | |
return len(p), nil | |
} | |
-func TestClient(t *testing.T) { | |
+func TestClient_h1(t *testing.T) { testClient(t, false) } | |
+func TestClient_h2(t *testing.T) { testClient(t, true) } | |
+ | |
+func testClient(t *testing.T, h2 bool) { | |
defer afterTest(t) | |
- ts := httptest.NewServer(robotsTxtHandler) | |
- defer ts.Close() | |
+ cst := newClientServerTest(t, h2, robotsTxtHandler) | |
+ defer cst.close() | |
- r, err := Get(ts.URL) | |
+ r, err := cst.c.Get(cst.ts.URL) | |
var b []byte | |
if err == nil { | |
b, err = pedanticReadAll(r.Body) | |
@@ -83,12 +86,15 @@ func TestClient(t *testing.T) { | |
} | |
} | |
-func TestClientHead(t *testing.T) { | |
+func TestClientHead_h1(t *testing.T) { testClientHead(t, false) } | |
+func TestClientHead_h2(t *testing.T) { testClientHead(t, true) } | |
+ | |
+func testClientHead(t *testing.T, h2 bool) { | |
defer afterTest(t) | |
- ts := httptest.NewServer(robotsTxtHandler) | |
- defer ts.Close() | |
+ cst := newClientServerTest(t, h2, robotsTxtHandler) | |
+ defer cst.close() | |
- r, err := Head(ts.URL) | |
+ r, err := Head(cst.ts.URL) | |
if err != nil { | |
t.Fatal(err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment