There was an error while loading. Please reload this page.
1 parent ff1cbff commit 7e23eafCopy full SHA for 7e23eaf
1 file changed
internal/jsonrpc2/stream_test.go
@@ -6,6 +6,9 @@ import (
6
"testing"
7
)
8
9
+var errWriteContentLen = errors.New("write content length error")
10
+var errWriteMsg = errors.New("write message error")
11
+
12
func TestStream(t *testing.T) {
13
t.Parallel()
14
@@ -102,14 +105,14 @@ type writerError struct{}
102
105
103
106
func (e *writerError) Write(p []byte) (n int, err error) {
104
107
if strings.Contains(string(p), "Content-Length: 0") {
- return 0, errors.New("write content length error")
108
+ return 0, errWriteContentLen
109
}
110
111
if strings.Contains(string(p), "Content-Length: ") {
112
return len(p), nil
113
114
- return 0, errors.New("write message error")
115
+ return 0, errWriteMsg
116
117
118
func TestStreamWriteMessageErr(t *testing.T) {
0 commit comments