forked from quic-go/quic-go
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:
@@ -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), "")
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user