Merge pull request #2371 from lorenzosaino/fix-http3-client-close

Make http3.client.Close() succeed if session was not started
This commit is contained in:
Marten Seemann
2020-02-28 12:00:50 +07:00
committed by GitHub
2 changed files with 9 additions and 0 deletions

View File

@@ -127,6 +127,9 @@ func (c *client) setupSession() error {
}
func (c *client) Close() error {
if c.session == nil {
return nil
}
return c.session.CloseWithError(quic.ErrorCode(errorNoError), "")
}

View File

@@ -146,6 +146,12 @@ var _ = Describe("Client", func() {
Expect(err).To(MatchError(testErr))
})
It("closes correctly if session was not created", func() {
client = newClient("localhost:1337", nil, &roundTripperOpts{}, nil, nil)
err := client.Close()
Expect(err).ToNot(HaveOccurred())
})
Context("Doing requests", func() {
var (
request *http.Request