diff --git a/lib/web/websocket/receiver.js b/lib/web/websocket/receiver.js index 18dc474f16e..eff9aea569f 100644 --- a/lib/web/websocket/receiver.js +++ b/lib/web/websocket/receiver.js @@ -102,7 +102,7 @@ class ByteParser extends Writable { const body = this.consume(payloadLength) - this.#info.closeInfo = this.parseCloseBody(false, body) + this.#info.closeInfo = this.parseCloseBody(body) if (!this.ws[kSentClose]) { // If an endpoint receives a Close frame and did not previously send a @@ -290,7 +290,7 @@ class ByteParser extends Writable { return buffer } - parseCloseBody (onlyCode, data) { + parseCloseBody (data) { // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5 /** @type {number|undefined} */ let code @@ -302,14 +302,6 @@ class ByteParser extends Writable { code = data.readUInt16BE(0) } - if (onlyCode) { - if (!isValidStatusCode(code)) { - return null - } - - return { code } - } - // https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6 /** @type {Buffer} */ let reason = data.subarray(2)