forked from quic-go/quic-go
improve error message in the h2quic client
This commit is contained in:
@@ -144,8 +144,7 @@ func (c *client) Do(req *http.Request) (*http.Response, error) {
|
|||||||
return nil, errors.New("quic http2: unsupported scheme")
|
return nil, errors.New("quic http2: unsupported scheme")
|
||||||
}
|
}
|
||||||
if authorityAddr("https", hostnameFromRequest(req)) != c.hostname {
|
if authorityAddr("https", hostnameFromRequest(req)) != c.hostname {
|
||||||
utils.Debugf("%s vs %s", req.Host, c.hostname)
|
return nil, fmt.Errorf("h2quic Client BUG: RoundTrip called for the wrong client (expected %s, got %s)", c.hostname, req.Host)
|
||||||
return nil, errors.New("h2quic Client BUG: Do called for the wrong client")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hasBody := (req.Body != nil)
|
hasBody := (req.Body != nil)
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ var _ = Describe("Client", func() {
|
|||||||
req, err := http.NewRequest("https", "https://quic.clemente.io:1336/foobar.html", nil)
|
req, err := http.NewRequest("https", "https://quic.clemente.io:1336/foobar.html", nil)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
_, err = client.Do(req)
|
_, 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() {
|
It("refuses to do plain HTTP requests", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user