mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
make the responseWriter hijackable
This commit is contained in:
parent
a983db0301
commit
ff6313fdb3
4 changed files with 13 additions and 6 deletions
|
@ -429,7 +429,7 @@ var _ = Describe("Client", func() {
|
|||
buf := &bytes.Buffer{}
|
||||
rstr := mockquic.NewMockStream(mockCtrl)
|
||||
rstr.EXPECT().Write(gomock.Any()).Do(buf.Write).AnyTimes()
|
||||
rw := newResponseWriter(rstr, utils.DefaultLogger)
|
||||
rw := newResponseWriter(rstr, nil, utils.DefaultLogger)
|
||||
rw.WriteHeader(status)
|
||||
rw.Flush()
|
||||
return buf.Bytes()
|
||||
|
@ -717,7 +717,7 @@ var _ = Describe("Client", func() {
|
|||
buf := &bytes.Buffer{}
|
||||
rstr := mockquic.NewMockStream(mockCtrl)
|
||||
rstr.EXPECT().Write(gomock.Any()).Do(buf.Write).AnyTimes()
|
||||
rw := newResponseWriter(rstr, utils.DefaultLogger)
|
||||
rw := newResponseWriter(rstr, nil, utils.DefaultLogger)
|
||||
rw.Header().Set("Content-Encoding", "gzip")
|
||||
gz := gzip.NewWriter(rw)
|
||||
gz.Write([]byte("gzipped response"))
|
||||
|
@ -743,7 +743,7 @@ var _ = Describe("Client", func() {
|
|||
buf := &bytes.Buffer{}
|
||||
rstr := mockquic.NewMockStream(mockCtrl)
|
||||
rstr.EXPECT().Write(gomock.Any()).Do(buf.Write).AnyTimes()
|
||||
rw := newResponseWriter(rstr, utils.DefaultLogger)
|
||||
rw := newResponseWriter(rstr, nil, utils.DefaultLogger)
|
||||
rw.Write([]byte("not gzipped"))
|
||||
rw.Flush()
|
||||
str.EXPECT().Write(gomock.Any()).AnyTimes().DoAndReturn(func(p []byte) (int, error) { return len(p), nil })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue