mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
add a context to Session.Open{Uni}StreamSync
This commit is contained in:
parent
e63a991950
commit
2b8cece60a
20 changed files with 218 additions and 104 deletions
|
@ -2,6 +2,7 @@ package http3
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io"
|
||||
|
@ -91,8 +92,8 @@ var _ = Describe("RoundTripper", func() {
|
|||
testErr := errors.New("test err")
|
||||
req, err := http.NewRequest("GET", "https://quic.clemente.io/foobar.html", nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session.EXPECT().OpenUniStreamSync().AnyTimes().Return(nil, testErr)
|
||||
session.EXPECT().OpenStreamSync().Return(nil, testErr)
|
||||
session.EXPECT().OpenUniStream().AnyTimes().Return(nil, testErr)
|
||||
session.EXPECT().OpenStreamSync(context.Background()).Return(nil, testErr)
|
||||
session.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).Do(func(quic.ErrorCode, string) { close(closed) })
|
||||
_, err = rt.RoundTrip(req)
|
||||
Expect(err).To(MatchError(testErr))
|
||||
|
@ -128,8 +129,8 @@ var _ = Describe("RoundTripper", func() {
|
|||
It("reuses existing clients", func() {
|
||||
closed := make(chan struct{})
|
||||
testErr := errors.New("test err")
|
||||
session.EXPECT().OpenUniStreamSync().AnyTimes().Return(nil, testErr)
|
||||
session.EXPECT().OpenStreamSync().Return(nil, testErr).Times(2)
|
||||
session.EXPECT().OpenUniStream().AnyTimes().Return(nil, testErr)
|
||||
session.EXPECT().OpenStreamSync(context.Background()).Return(nil, testErr).Times(2)
|
||||
session.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).Do(func(quic.ErrorCode, string) { close(closed) })
|
||||
req, err := http.NewRequest("GET", "https://quic.clemente.io/file1.html", nil)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue