Return a copy of the data from FakeWebSocket
The caller might hang on to the data for multiple calls, so we make sure the returned buffer might not get overwritten.
This commit is contained in:
@@ -42,7 +42,7 @@ export default class FakeWebSocket {
|
||||
}
|
||||
|
||||
_getSentData() {
|
||||
const res = new Uint8Array(this._sendQueue.buffer, 0, this.bufferedAmount);
|
||||
const res = this._sendQueue.slice(0, this.bufferedAmount);
|
||||
this.bufferedAmount = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user