diff --git a/lib/_http_server.js b/lib/_http_server.js index c0172ccf52d1d9..799a1c55932b8b 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -499,13 +499,14 @@ function onParserExecute(server, socket, parser, state, ret) { onParserExecuteCommon(server, socket, parser, state, ret, undefined); } +const noop = () => {}; const badRequestResponse = Buffer.from( `HTTP/1.1 400 ${STATUS_CODES[400]}${CRLF}${CRLF}`, 'ascii' ); function socketOnError(e) { // Ignore further errors this.removeListener('error', socketOnError); - this.on('error', () => {}); + this.on('error', noop); if (!this.server.emit('clientError', e, this)) { if (this.writable) {