From c2a89e6b78f76b8348a2f7a3621f5d2db0260f1d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 3 Jun 2017 17:39:54 +0200 Subject: [PATCH] improve error message in the h2quic client --- h2quic/client.go | 3 +-- h2quic/client_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/h2quic/client.go b/h2quic/client.go index 91e33791..c0a71173 100644 --- a/h2quic/client.go +++ b/h2quic/client.go @@ -144,8 +144,7 @@ func (c *client) Do(req *http.Request) (*http.Response, error) { return nil, errors.New("quic http2: unsupported scheme") } if authorityAddr("https", hostnameFromRequest(req)) != c.hostname { - utils.Debugf("%s vs %s", req.Host, c.hostname) - return nil, errors.New("h2quic Client BUG: Do called for the wrong client") + return nil, fmt.Errorf("h2quic Client BUG: RoundTrip called for the wrong client (expected %s, got %s)", c.hostname, req.Host) } hasBody := (req.Body != nil) diff --git a/h2quic/client_test.go b/h2quic/client_test.go index a9451f5a..890a2707 100644 --- a/h2quic/client_test.go +++ b/h2quic/client_test.go @@ -212,7 +212,7 @@ var _ = Describe("Client", func() { req, err := http.NewRequest("https", "https://quic.clemente.io:1336/foobar.html", nil) Expect(err).ToNot(HaveOccurred()) _, err = client.Do(req) - Expect(err).To(MatchError("h2quic Client BUG: Do called for the wrong client")) + Expect(err).To(MatchError("h2quic Client BUG: RoundTrip called for the wrong client (expected quic.clemente.io:1337, got quic.clemente.io:1336)")) }) It("refuses to do plain HTTP requests", func() {