make hijack more stable (#565)

This commit is contained in:
Kevin Wan
2021-03-15 20:11:09 +08:00
committed by GitHub
parent fcd15c9b17
commit 3c6951577d
6 changed files with 107 additions and 3 deletions

View File

@@ -103,3 +103,16 @@ func TestCryptionHandlerFlush(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, base64.StdEncoding.EncodeToString(expect), recorder.Body.String())
}
func TestCryptionHandler_Hijack(t *testing.T) {
resp := httptest.NewRecorder()
writer := newCryptionResponseWriter(resp)
assert.NotPanics(t, func() {
writer.Hijack()
})
writer = newCryptionResponseWriter(mockedHijackable{resp})
assert.NotPanics(t, func() {
writer.Hijack()
})
}