Skip to content

Commit

Permalink
Merge branch 'master' into last_message_recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed May 14, 2024
2 parents 40dd975 + 7569881 commit c7b9733
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/websocket/client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,51 +72,51 @@ func newTLSServer(t *testing.T) *cstServer {

func (t cstHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != cstPath {
t.Logf("path=%v, want %v", r.URL.Path, cstPath)
//t.Logf("path=%v, want %v", r.URL.Path, cstPath)
http.Error(w, "bad path", http.StatusBadRequest)
return
}
if r.URL.RawQuery != cstRawQuery {
t.Logf("query=%v, want %v", r.URL.RawQuery, cstRawQuery)
//t.Logf("query=%v, want %v", r.URL.RawQuery, cstRawQuery)
http.Error(w, "bad path", http.StatusBadRequest)
return
}
subprotos := Subprotocols(r)
if !reflect.DeepEqual(subprotos, cstDialer.Subprotocols) {
t.Logf("subprotols=%v, want %v", subprotos, cstDialer.Subprotocols)
//t.Logf("subprotols=%v, want %v", subprotos, cstDialer.Subprotocols)
http.Error(w, "bad protocol", http.StatusBadRequest)
return
}
ws, subprotocol, err := cstUpgrader.Upgrade(w, r, http.Header{"Set-Cookie": {"sessionID=1234"}})
if err != nil {
t.Logf("Upgrade: %v", err)
//t.Logf("Upgrade: %v", err)
return
}
defer func() {
_ = ws.Close()
}()

if subprotocol != "p1" {
t.Logf("Subprotocol() = %s, want p1", subprotocol)
//t.Logf("Subprotocol() = %s, want p1", subprotocol)
_ = ws.Close()
return
}
op, rd, err := ws.NextReader()
if err != nil {
t.Logf("NextReader: %v", err)
//t.Logf("NextReader: %v", err)
return
}
wr, err := ws.NextWriter(op)
if err != nil {
t.Logf("NextWriter: %v", err)
//t.Logf("NextWriter: %v", err)
return
}
if _, err = io.Copy(wr, rd); err != nil {
t.Logf("NextWriter: %v", err)
//t.Logf("Copy: %v", err)
return
}
if err := wr.Close(); err != nil {
t.Logf("Close: %v", err)
//t.Logf("Close: %v", err)
return
}
}
Expand Down

0 comments on commit c7b9733

Please sign in to comment.