@@ -34,7 +34,7 @@ func TestHandshake(t *testing.T) {
34
34
{
35
35
name : "handshake" ,
36
36
server : func (w http.ResponseWriter , r * http.Request ) error {
37
- c , err := websocket .Accept (w , r , websocket .AcceptProtocols ("myproto" ))
37
+ c , err := websocket .Accept (w , r , websocket .AcceptSubprotocols ("myproto" ))
38
38
if err != nil {
39
39
return err
40
40
}
@@ -74,8 +74,8 @@ func TestHandshake(t *testing.T) {
74
74
}
75
75
defer c .Close (websocket .StatusInternalError , "" )
76
76
77
- if c .Protocol () != "" {
78
- return xerrors .Errorf ("unexpected subprotocol: %v" , c .Protocol ())
77
+ if c .Subprotocol () != "" {
78
+ return xerrors .Errorf ("unexpected subprotocol: %v" , c .Subprotocol ())
79
79
}
80
80
return nil
81
81
},
@@ -86,23 +86,23 @@ func TestHandshake(t *testing.T) {
86
86
}
87
87
defer c .Close (websocket .StatusInternalError , "" )
88
88
89
- if c .Protocol () != "" {
90
- return xerrors .Errorf ("unexpected subprotocol: %v" , c .Protocol ())
89
+ if c .Subprotocol () != "" {
90
+ return xerrors .Errorf ("unexpected subprotocol: %v" , c .Subprotocol ())
91
91
}
92
92
return nil
93
93
},
94
94
},
95
95
{
96
96
name : "subprotocol" ,
97
97
server : func (w http.ResponseWriter , r * http.Request ) error {
98
- c , err := websocket .Accept (w , r , websocket .AcceptProtocols ("echo" , "lar" ))
98
+ c , err := websocket .Accept (w , r , websocket .AcceptSubprotocols ("echo" , "lar" ))
99
99
if err != nil {
100
100
return err
101
101
}
102
102
defer c .Close (websocket .StatusInternalError , "" )
103
103
104
- if c .Protocol () != "echo" {
105
- return xerrors .Errorf ("unexpected subprotocol: %q" , c .Protocol ())
104
+ if c .Subprotocol () != "echo" {
105
+ return xerrors .Errorf ("unexpected subprotocol: %q" , c .Subprotocol ())
106
106
}
107
107
return nil
108
108
},
@@ -113,8 +113,8 @@ func TestHandshake(t *testing.T) {
113
113
}
114
114
defer c .Close (websocket .StatusInternalError , "" )
115
115
116
- if c .Protocol () != "echo" {
117
- return xerrors .Errorf ("unexpected subprotocol: %q" , c .Protocol ())
116
+ if c .Subprotocol () != "echo" {
117
+ return xerrors .Errorf ("unexpected subprotocol: %q" , c .Subprotocol ())
118
118
}
119
119
return nil
120
120
},
@@ -266,7 +266,7 @@ func TestAutobahnServer(t *testing.T) {
266
266
267
267
s := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
268
268
c , err := websocket .Accept (w , r ,
269
- websocket .AcceptProtocols ("echo" ),
269
+ websocket .AcceptSubprotocols ("echo" ),
270
270
)
271
271
if err != nil {
272
272
t .Logf ("server handshake failed: %+v" , err )
0 commit comments