File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ func BenchmarkRandKey(b *testing.B) {
18
18
}
19
19
20
20
func TestDial (t * testing.T ) {
21
- var text = []byte ("Make fasthttp great again" )
22
- var uri = "http://localhost:9843/"
21
+ text : = []byte ("Make fasthttp great again" )
22
+ uri : = "http://localhost:9843/"
23
23
ln := fasthttputil .NewInmemoryListener ()
24
24
25
25
ws := Server {
@@ -33,11 +33,7 @@ func TestDial(t *testing.T) {
33
33
})
34
34
35
35
ws .HandleClose (func (c * Conn , err error ) {
36
- if err == nil {
37
- t .Fatal ("Expected err" )
38
- }
39
-
40
- if err .(Error ).Status != StatusGoAway {
36
+ if err != nil && err .(Error ).Status != StatusGoAway {
41
37
t .Fatalf ("Expected GoAway, got %s" , err .(Error ).Status )
42
38
}
43
39
})
Original file line number Diff line number Diff line change @@ -3,18 +3,19 @@ package websocket
3
3
import (
4
4
"bufio"
5
5
"fmt"
6
- "github.com/valyala/fasthttp"
7
- "github.com/valyala/fasthttp/fasthttputil"
8
6
"io"
9
7
"testing"
8
+
9
+ "github.com/valyala/fasthttp"
10
+ "github.com/valyala/fasthttp/fasthttputil"
10
11
)
11
12
12
13
func configureServer (t * testing.T ) (* fasthttp.Server , * fasthttputil.InmemoryListener ) {
13
14
ln := fasthttputil .NewInmemoryListener ()
14
15
15
16
ws := Server {}
16
17
17
- var stage = 0
18
+ stage : = 0
18
19
19
20
ws .HandleData (func (c * Conn , isBinary bool , data []byte ) {
20
21
switch stage {
@@ -154,8 +155,8 @@ func TestReadFrame(t *testing.T) {
154
155
155
156
fr .Reset ()
156
157
_ , err = conn .ReadFrame (fr )
157
- if ! fr .IsClose () {
158
- t .Fatal ("Unexpected frame close" )
158
+ if ! fr .IsContinuation () {
159
+ t .Fatalf ("Unexpected frame %s" , fr . Code () )
159
160
}
160
161
161
162
ln .Close ()
You can’t perform that action at this time.
0 commit comments