mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 09:07:45 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
31 lines
727 B
JavaScript
31 lines
727 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
const net = require('net');
|
|
|
|
const s = http.createServer(function(req, res) {
|
|
res.statusCode = 200;
|
|
res.statusMessage = 'Custom Message';
|
|
res.end('');
|
|
});
|
|
|
|
s.listen(0, test);
|
|
|
|
|
|
function test() {
|
|
const bufs = [];
|
|
const client = net.connect(this.address().port, function() {
|
|
client.write('GET / HTTP/1.1\r\nConnection: close\r\n\r\n');
|
|
});
|
|
client.on('data', function(chunk) {
|
|
bufs.push(chunk);
|
|
});
|
|
client.on('end', function() {
|
|
const head = Buffer.concat(bufs).toString('latin1').split('\r\n')[0];
|
|
assert.equal('HTTP/1.1 200 Custom Message', head);
|
|
console.log('ok');
|
|
s.close();
|
|
});
|
|
}
|