mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
http3: add compatibility with net/http.ResponseController (#3790)
* feat: compatibility with "net/http".ResponseController * better deadline tests * don't run deadline tests on Go 1.19 * skip deadline tests on Go 1.19
This commit is contained in:
parent
4a2a5740b2
commit
172123c340
5 changed files with 129 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
mockquic "github.com/quic-go/quic-go/internal/mocks/quic"
|
||||
"github.com/quic-go/quic-go/internal/utils"
|
||||
|
@ -25,6 +26,8 @@ var _ = Describe("Response Writer", func() {
|
|||
strBuf = &bytes.Buffer{}
|
||||
str := mockquic.NewMockStream(mockCtrl)
|
||||
str.EXPECT().Write(gomock.Any()).DoAndReturn(strBuf.Write).AnyTimes()
|
||||
str.EXPECT().SetReadDeadline(gomock.Any()).Return(nil).AnyTimes()
|
||||
str.EXPECT().SetWriteDeadline(gomock.Any()).Return(nil).AnyTimes()
|
||||
rw = newResponseWriter(str, nil, utils.DefaultLogger)
|
||||
})
|
||||
|
||||
|
@ -156,4 +159,9 @@ var _ = Describe("Response Writer", func() {
|
|||
fields := decodeHeader(strBuf)
|
||||
Expect(fields).To(HaveKeyWithValue("content-type", []string{"text/html; charset=utf-8"}))
|
||||
})
|
||||
|
||||
It(`is compatible with "net/http".ResponseController`, func() {
|
||||
Expect(rw.SetReadDeadline(time.Now().Add(1 * time.Second))).To(BeNil())
|
||||
Expect(rw.SetWriteDeadline(time.Now().Add(1 * time.Second))).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue