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:
parent
9c7576a587
commit
9e02f4d01d
|
@ -42,7 +42,7 @@ export default class FakeWebSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
_getSentData() {
|
_getSentData() {
|
||||||
const res = new Uint8Array(this._sendQueue.buffer, 0, this.bufferedAmount);
|
const res = this._sendQueue.slice(0, this.bufferedAmount);
|
||||||
this.bufferedAmount = 0;
|
this.bufferedAmount = 0;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue