@@ -315,7 +315,7 @@ func TestWsPassthrough(t *testing.T) {
315315 defer deleteSession (t , controlURL , session .SessionID )
316316
317317 // Connect through proxy
318- conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ), "key=test.key:secret" )
318+ conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ), "format=json" , " key=test.key:secret" )
319319 defer conn .Close ()
320320
321321 // Should receive CONNECTED from mock upstream
@@ -467,7 +467,7 @@ func TestWsFrameSuppression(t *testing.T) {
467467 })
468468 defer deleteSession (t , controlURL , session .SessionID )
469469
470- conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ))
470+ conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ), "format=json" )
471471 defer conn .Close ()
472472
473473 // Read CONNECTED
@@ -515,7 +515,7 @@ func TestWsInjectAndClose(t *testing.T) {
515515 })
516516 defer deleteSession (t , controlURL , session .SessionID )
517517
518- conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ))
518+ conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ), "format=json" )
519519 defer conn .Close ()
520520
521521 // Should receive the injected DISCONNECTED message
@@ -672,7 +672,7 @@ func TestWsSuppressOnwards(t *testing.T) {
672672 })
673673 defer deleteSession (t , controlURL , session .SessionID )
674674
675- conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ))
675+ conn := connectWs (t , fmt .Sprintf ("localhost:%d" , port ), "format=json" )
676676 defer conn .Close ()
677677
678678 // Read CONNECTED (arrives before suppress_onwards fires)
@@ -854,7 +854,7 @@ func TestRuleTimesLimit(t *testing.T) {
854854
855855func TestProtocolParseJSON (t * testing.T ) {
856856 msg := `{"action":10,"channel":"test-channel"}`
857- pm := ParseProtocolMessage ([]byte (msg ), websocket . TextMessage )
857+ pm := ParseProtocolMessage ([]byte (msg ), "json" )
858858 if pm .Action != ActionAttach {
859859 t .Fatalf ("expected action %d, got %d" , ActionAttach , pm .Action )
860860 }
@@ -865,7 +865,7 @@ func TestProtocolParseJSON(t *testing.T) {
865865
866866func TestProtocolParseJSONWithError (t * testing.T ) {
867867 msg := `{"action":9,"error":{"code":40142,"statusCode":401,"message":"Token expired"}}`
868- pm := ParseProtocolMessage ([]byte (msg ), websocket . TextMessage )
868+ pm := ParseProtocolMessage ([]byte (msg ), "json" )
869869 if pm .Action != ActionError {
870870 t .Fatalf ("expected action %d, got %d" , ActionError , pm .Action )
871871 }
@@ -885,7 +885,7 @@ func TestProtocolParseMsgpack(t *testing.T) {
885885 "channel" : "test" ,
886886 }
887887 data := mustMarshalMsgpack (t , raw )
888- pm := ParseProtocolMessage (data , websocket . BinaryMessage )
888+ pm := ParseProtocolMessage (data , "msgpack" )
889889 if pm .Action != ActionAttach {
890890 t .Fatalf ("expected action %d, got %d" , ActionAttach , pm .Action )
891891 }
0 commit comments