1'use strict';
2
3const common = require('../common');
4const net = require('net');
5const http = require('http');
6const assert = require('assert');
7
8const str = 'GET / HTTP/1.1\r\n' +
9            'Dummy: Header\r' +
10            'Content-Length: 1\r\n' +
11            '\r\n';
12
13
14const server = http.createServer(common.mustNotCall());
15server.on('clientError', common.mustCall((err) => {
16  assert.match(err.message, /^Parse Error/);
17  assert.strictEqual(err.code, 'HPE_LF_EXPECTED');
18  server.close();
19}));
20server.listen(0, () => {
21  const client = net.connect({ port: server.address().port }, () => {
22    client.on('data', common.mustNotCall());
23    client.on('end', common.mustCall(() => {
24      server.close();
25    }));
26    client.write(str);
27    client.end();
28  });
29});
30