test(qr): wait for the client to close after the gateway cancels

This commit is contained in:
ayn2op 2026-10-04 23:55:16 -04:00
parent c947abdf0e
commit fca6ea5c1d

View file

@ -67,6 +67,10 @@ func serveGateway(t *testing.T, acks int) http.HandlerFunc {
}
if shown && acks <= 0 {
_ = conn.WriteJSON(map[string]any{"op": "cancel"})
// Closing first would fail the client's next heartbeat before it reads the cancel.
for err == nil {
_, _, err = conn.ReadMessage()
}
return
}
}