0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-http-server-unconsume-consume.js
Vse Mozhet Byt 71abfa9548 tools: use no-useless-concat ESLint rule
* Add `no-useless-concat: error` to .eslintrc.yaml.
* Apply no-useless-concat rule to tests.

PR-URL: https://github.com/nodejs/node/pull/12613
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2017-04-25 22:28:46 +03:00

20 lines
602 B
JavaScript

'use strict';
const common = require('../common');
const http = require('http');
const testServer = http.createServer(common.mustNotCall());
testServer.on('connect', common.mustCall((req, socket, head) => {
socket.write('HTTP/1.1 200 Connection Established\r\n' +
'Proxy-agent: Node-Proxy\r\n' +
'\r\n');
// This shouldn't raise an assertion in StreamBase::Consume.
testServer.emit('connection', socket);
testServer.close();
}));
testServer.listen(0, common.mustCall(() => {
http.request({
port: testServer.address().port,
method: 'CONNECT'
}, (res) => {}).end();
}));